Skip to content

Instantly share code, notes, and snippets.

@electronicbites
Created September 28, 2012 12:03
Show Gist options
  • Save electronicbites/3799426 to your computer and use it in GitHub Desktop.
Save electronicbites/3799426 to your computer and use it in GitHub Desktop.
sample for specs for gamecontroller
it 'should contain a collection of games' do
game1 = FactoryGirl.create(:game, titel: 'foo1')
game2 = FactoryGirl.create(:game, titel: 'foo2')
get :index
json = ActiveSupport::JSON.decode(response.body)
json[:game].size == 2
end
it 'should contain the title of the game' do
game = FactoryGirl.create(:game, titel: 'foo1')
get :index
json = ActiveSupport::JSON.decode(response.body)
json[:game].first[:title].should == 'foo1'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment