@@ -9,6 +9,10 @@ def jekyll_test_site
99 File . join ( File . dirname ( __FILE__ ) , 'test_site' )
1010end
1111
12+ def get_about_page ( site )
13+ return site . pages [ 0 ]
14+ end
15+
1216class Jekyll ::NetlifyTest < Minitest ::Test
1317 context 'normal build' do
1418 setup do
@@ -26,6 +30,8 @@ class Jekyll::NetlifyTest < Minitest::Test
2630 @site = Jekyll ::Site . new ( config )
2731 @site . read
2832 @site . generate
33+ @site . render
34+ @about_page = get_about_page ( @site )
2935 end
3036
3137 context 'netlify info' do
@@ -37,6 +43,13 @@ class Jekyll::NetlifyTest < Minitest::Test
3743 assert_equal false , @netlify
3844 end
3945 end
46+
47+ context 'site.url' do
48+ should 'be from _config.yml' do
49+ assert_equal 'http://fake.com' , @site . config [ 'url' ]
50+ assert_operator @about_page . output , :include? , 'http://fake.com'
51+ end
52+ end
4053 end
4154
4255 context 'netlify production context' do
@@ -61,6 +74,8 @@ class Jekyll::NetlifyTest < Minitest::Test
6174 @site = Jekyll ::Site . new ( config )
6275 @site . read
6376 @site . generate
77+ @site . render
78+ @about_page = get_about_page ( @site )
6479 end
6580
6681 context 'info' do
@@ -92,14 +107,25 @@ class Jekyll::NetlifyTest < Minitest::Test
92107 assert_equal false , @netlify [ 'webhook' ]
93108 end
94109 end
110+
111+ context 'site.url' do
112+ should 'be netlify production url' do
113+ assert_equal 'https://example.com' , @site . config [ 'url' ]
114+ end
115+ should 'be expanded in about.md' do
116+ assert_operator @about_page . output , :include? , 'https://example.com'
117+ end
118+ end
95119 end
120+
96121 context 'netlify deploy-preview context' do
97122 setup do
98123 Jekyll . instance_variable_set (
99124 :@logger , Jekyll ::LogAdapter . new ( Jekyll ::Stevenson . new , :error )
100125 )
101126
102127 ENV . clear
128+ ENV [ 'URL' ] = 'https://example.com'
103129 ENV [ 'CONTEXT' ] = 'deploy-preview'
104130 ENV [ 'JEKYLL_ENV' ] = 'staging'
105131
@@ -114,6 +140,8 @@ class Jekyll::NetlifyTest < Minitest::Test
114140 @site = Jekyll ::Site . new ( config )
115141 @site . read
116142 @site . generate
143+ @site . render
144+ @about_page = get_about_page ( @site )
117145 end
118146
119147 context 'info' do
@@ -125,6 +153,15 @@ class Jekyll::NetlifyTest < Minitest::Test
125153 assert_equal 'staging-deploy-preview' , @netlify [ 'environment' ]
126154 end
127155 end
156+
157+ context 'site.url' do
158+ should 'be netlify deploy-preview url' do
159+ assert_equal ENV [ 'DEPLOY_URL' ] , @site . config [ 'url' ]
160+ end
161+ should 'be expanded in about.md' do
162+ assert_operator @about_page . output , :include? , ENV [ 'DEPLOY_URL' ]
163+ end
164+ end
128165 end
129166
130167 context 'netlify unrecognised pull request' do
0 commit comments