spec/models/landable/page_spec.rb in landable-1.12.1 vs spec/models/landable/page_spec.rb in landable-1.12.2
- old
+ new
@@ -261,19 +261,24 @@
page.preview_url.should == 'foo'
end
end
describe '::sitemappable' do
- let(:page) { create :page }
+ let(:page) {
+ create :page do |page|
+ page.publish! author: create(:author), notes: 'yo'
+ end
+ }
let(:page_2) { create :page, :redirect }
let(:page_3) { create :page, meta_tags: { 'robots' => 'noindex' } }
+ let(:page_4) { create :page }
- it 'only returns pages with a status code of 200 and dont have a noindex tag' do
+ it 'only returns published pages with a status code of 200 and dont have a noindex tag' do
page_2.status_code.should == 301
Landable::Page.sitemappable.should include(page)
- Landable::Page.sitemappable.should_not include(page_2, page_3)
+ Landable::Page.sitemappable.should_not include(page_2, page_3, page_4)
end
end
describe '#downcase_path' do
it 'should force a path to be lowercase' do
@@ -322,10 +327,12 @@
end
describe '::generate_sitemap' do
it 'returns a sitemap' do
page = create :page
+ page.publish! author: create(:author), notes: 'yo'
+
Landable::Page.generate_sitemap(host: 'example.com',
protocol: 'http',
exclude_categories: [],
sitemap_additional_paths: []).should include("<loc>http://example.com#{page.path}</loc>")
end
@@ -339,9 +346,11 @@
sitemap_additional_paths: []).should_not include("<loc>http://example.com#{page.path}</loc>")
end
it 'can handle https protocol' do
page = create :page
+ page.publish! author: create(:author), notes: 'yo'
+
Landable::Page.generate_sitemap(host: 'example.com',
protocol: 'https',
exclude_categories: [],
sitemap_additional_paths: []).should include("<loc>https://example.com#{page.path}</loc>")
end