2014-03-31 19:49:54 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-02-19 01:12:08 +00:00
|
|
|
describe SitemapController, type: :controller do
|
2014-03-31 19:49:54 +01:00
|
|
|
describe 'robots' do
|
|
|
|
|
|
|
|
it 'is successful' do
|
|
|
|
get :robots
|
2015-04-07 20:43:40 +01:00
|
|
|
expect(response).to be_success
|
|
|
|
expect(response).to render_template('sitemap/robots')
|
2014-03-31 19:49:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'validate robots.txt' do
|
|
|
|
render_views
|
|
|
|
|
|
|
|
it 'ensures that Host is correct' do
|
|
|
|
get :robots
|
2015-04-07 20:43:40 +01:00
|
|
|
expect(response.body).to match(/^Host: http:\/\/test.host$/)
|
2014-03-31 19:49:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'ensures that Sitemap is correct' do
|
|
|
|
get :robots
|
2015-04-07 20:43:40 +01:00
|
|
|
expect(response.body).to match(/^Sitemap: http:\/\/test.host\/sitemap.xml.gz$/)
|
2014-03-31 19:49:54 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'show' do
|
|
|
|
|
|
|
|
it 'is successful' do
|
|
|
|
get :show
|
2015-04-07 20:43:40 +01:00
|
|
|
expect(response).to redirect_to("/sitemaps/test.host/sitemap.xml.gz")
|
2014-03-31 19:49:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|