stubbing a before_filter that calls out to an api
Language: Ruby
# i had a problem with a before filter that used information from another api.
# The api was called all the time in an around filter and i'd use the information to then verify.
# Well now when i need to stub out a before filter in a functional test i use this code snippet:
test "User should create user"
@controller.stubs(:active_user?).returns(true)
get :edit, :id => users(:one).to_param
assert_response :success
end
Reveal More
