Skip to content

Instantly share code, notes, and snippets.

@koos
Created November 23, 2011 21:17
Show Gist options
  • Save koos/1389943 to your computer and use it in GitHub Desktop.
Save koos/1389943 to your computer and use it in GitHub Desktop.
describe PeopleController do
shared_examples 'successful response' do
it 'should be successful' do
response.should be_success
end
it 'should respond in JSON format' do
response.content_type.should == 'application/json'
end
end
[...]
describe 'GET /people/:id (#show)' do
before :each do
get :show, :id => Person.first, :format => :json
end
it_should_behave_like 'successful response'
it 'should have your custom behaviour...' do
# foo
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment