Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cucumber tests #205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/warden/test/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def self.included(_base)
::Warden.test_mode!
end

def self.extended(_base)
::Warden.test_mode!
end

# A helper method that will perform a login of a user in warden for the next request.
# Provide it the same options as you would to Warden::Proxy#set_user
# @see Warden::Proxy#set_user
Expand Down
14 changes: 14 additions & 0 deletions spec/warden/test/helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
before{ $captures = [] }
after{ Warden.test_reset! }

describe ".included" do
it "should prepare Warden for testing" do
expect(Warden).to receive(:test_mode!)
Class.new { include(Warden::Test::Helpers) }
end
end

describe ".extended" do
it "should prepare Warden for testing" do
expect(Warden).to receive(:test_mode!)
Object.new.extend(Warden::Test::Helpers)
end
end

it "should log me in as a user" do
user = "A User"
login_as user
Expand Down