Skip to content

Instantly share code, notes, and snippets.

@trobrock
Created July 2, 2010 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trobrock/461667 to your computer and use it in GitHub Desktop.
Save trobrock/461667 to your computer and use it in GitHub Desktop.
describe CardsController, "for a logged in user" do
before(:each) do
@cardset = Factory(:cardset)
profile = @cardset.profile
controller.stubs(:require_user).returns(true)
controller.stubs(:current_user).returns(profile)
end
context "and created card" do
before(:each) do
@card = Factory(:card)
end
context "with get to show" do
context "with valid cardset" do
before(:each) do
Cardset.any_instance.stubs(:find_by_id).returns(@cardset)
Card.any_instance.stubs(:find_by_id).returns(@card)
get :show, :cardset_id => @cardset.id, :id => @card.id
end
it "should assign card" do
assigns[:card].should_not be_nil
end
it "should assign cardset" do
assigns[:cardset].should_not be_nil
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment