Skip to content

Instantly share code, notes, and snippets.

@bantic
Forked from sj26/devise_matchers.rb
Created December 12, 2012 23:27
Show Gist options
  • Save bantic/4272656 to your computer and use it in GitHub Desktop.
Save bantic/4272656 to your computer and use it in GitHub Desktop.
RSpec::Matchers.define :be_signed_in do
match do |user|
warden.user == user
end
failure_message_for_should do |user|
"expected #{user} to be signed in, but was not"
end
failure_message_for_should_not do |user|
"expected #{user} not to be signed in, but *was* signed in"
end
description do
"be signed in"
end
end
# use:
# @user.should be_signed_in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment