Skip to content

Instantly share code, notes, and snippets.

@arturaz
Created August 23, 2012 17:54
Show Gist options
  • Save arturaz/3439443 to your computer and use it in GitHub Desktop.
Save arturaz/3439443 to your computer and use it in GitHub Desktop.
describe "planets|player_index" do
before(:each) do
@action = "planets|player_index"
@params = {}
end
it_behaves_like "only push"
it_should_behave_like "having controller action scope"
it "should return players planets" do
planet0 = Factory.create :planet_with_player
planet1 = Factory.create :planet_with_player,
:player => player
planet2 = Factory.create :planet_with_player,
:player => player
planet3 = Factory.create :planet_with_player
push @action, @params
# Try to account for time difference
[planet1, planet2].each_with_index do |planet, index|
planet.reload
response[:planets][index].should equal_to_hash(
planet.as_json(:index => true, :view => true))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment