Skip to content

Instantly share code, notes, and snippets.

@jschoolcraft
Created April 6, 2009 17:19
Show Gist options
  • Save jschoolcraft/90842 to your computer and use it in GitHub Desktop.
Save jschoolcraft/90842 to your computer and use it in GitHub Desktop.
it "redirects to the tags list" do
tag_name = "productivity"
my_mock_tag = mock_model(Tag, :name => tag_name, :destroy => true)
Tag.stub!(:find).with("37").and_return(my_mock_tag)
delete :destroy, :id => "37"
response.should redirect_to(tags_url)
flash[:notice].should == "Stopped monitoring #{tag_name}"
end
18 examples, 2 failures
/opt/local/bin/ruby /opt/local/lib/ruby/gems/1.8/gems/rspec-1.2.2/bin/spec --autospec spec/controllers/tags_controller_spec.rb -O spec/spec.opts
F.................
1)
Spec::Mocks::MockExpectationError in 'TagsController DELETE destroy destroys the requested tag'
Mock 'Tag_1001' received unexpected message :name with (no args)
/Users/jeff/development/dagg/app/controllers/tags_controller.rb:78:in `destroy'
./spec/controllers/tags_controller_spec.rb:160:
Finished in 0.140807 seconds
18 examples, 1 failure
def destroy
tag = Tag.find(params[:id])
tag_name = tag.name
tag.destroy
respond_to do |format|
format.html do
flash[:notice] = "Stopped monitoring #{tag_name}"
redirect_to(tags_url)
end
format.xml { head :ok }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment