Skip to content

Instantly share code, notes, and snippets.

@alecslupu
Created May 8, 2013 17:36
Show Gist options
  • Save alecslupu/5542106 to your computer and use it in GitHub Desktop.
Save alecslupu/5542106 to your computer and use it in GitHub Desktop.
class MyController < ApplicationController
def redirect_to_home
true
end
end
my test
describe MyController do
describe "some behavior" do
context "redirect_to_home" do
before(:each) do
post :create, user: @hash
login_and_activate :user
end
it "should call redirect_to_home" do
controller.should_receive(:redirect_to_home)
get :new
end
end
end
end
Failures:
1) MyController some behavior should call redirect_to_home"
Failure/Error: controller.should_receive(:redirect_to_home)
(#<MyController:0x007f815b342478>).redirect_to_home(any args)
expected: 1 time
received: 0 times
# ./spec/controllers/users_controller_spec.rb:83:in `block (5 levels) in <top (required)>'
Finished in 9.11 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment