Skip to content

Commit 1aaf198

Browse files
authored
Little Perron::Site data helper (#5)
1 parent 4b7dda4 commit 1aaf198

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

lib/perron/site.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ def collections
2727
.map { Collection.new(it) }
2828
end
2929

30-
def collection(name)
31-
Collection.new(name)
30+
def collection(name) = Collection.new(name)
31+
32+
def data(name)
33+
Perron::Data.new(name)
3234
end
3335
end
3436
end

test/site_test.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require "test_helper"
2+
3+
require "fileutils"
4+
5+
class SiteTest < ActiveSupport::TestCase
6+
setup do
7+
Perron.configure do |config|
8+
config.site_name = "Test Site"
9+
config.site_email = "[email protected]"
10+
config.default_url_options = { protocol: "https", host: "example.com" }
11+
end
12+
end
13+
14+
test ".name returns the name from the configuration" do
15+
assert_equal "Test Site", Perron::Site.name
16+
end
17+
18+
test ".email returns the email from the configuration" do
19+
assert_equal "[email protected]", Perron::Site.email
20+
end
21+
22+
test ".url builds the URL from the configuration" do
23+
assert_equal "https://example.com", Perron::Site.url
24+
end
25+
end

0 commit comments

Comments
 (0)