Skip to content

Instantly share code, notes, and snippets.

@chriscooning
Created October 20, 2014 18:31
Show Gist options
  • Select an option

  • Save chriscooning/2696e6d8cea751e7b27b to your computer and use it in GitHub Desktop.

Select an option

Save chriscooning/2696e6d8cea751e7b27b to your computer and use it in GitHub Desktop.
static_controller_spec.rb
require "spec_helper"
def check_page_availability(name)
get :show, format: :html, page: name
expect(response.status).to eq 200
end
describe StaticController do
render_views
context "render pages" do
it 'features' do
check_page_availability('features')
end
it 'privacy' do
check_page_availability('privacy')
end
it 'support' do
check_page_availability('support')
end
it 'team' do
check_page_availability('team')
end
it 'terms' do
check_page_availability('terms')
end
it 'displays correcty 500 message if page not exists' do
expect {
get :show, format: :html, page: :this_page_should_never_exists
expect(response.status).to eq(500)
}.to raise_error(ActionController::RoutingError)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment