Skip to content

Commit

Permalink
test: Add spec for BackDoor middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
hasghari committed Aug 14, 2024
1 parent a9a9303 commit 45153ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/dummy/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class Application < Rails::Application
config.paths["log"] = "tmp/log/development.log"
config.paths.add "config/routes.rb", with: "#{APP_ROOT}/config/routes.rb"

config.middleware.use Clearance::BackDoor

def require_environment!
initialize!
end
Expand Down
11 changes: 11 additions & 0 deletions spec/requests/backdoor_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "spec_helper"

describe "Backdoor Middleware" do
it "allows signing in using query parameter" do
user = create(:user)

get root_path(as: user.to_param)

expect(cookies["remember_token"]).to eq user.remember_token
end
end

0 comments on commit 45153ce

Please sign in to comment.