mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 02:53:45 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
22 lines
553 B
Ruby
22 lines
553 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe CurrentUser do
|
|
it "allows us to lookup a user from our environment" do
|
|
user = Fabricate(:user, active: true)
|
|
token = UserAuthToken.generate!(user_id: user.id)
|
|
|
|
cookie = create_auth_cookie(
|
|
token: token.unhashed_auth_token,
|
|
user_id: user.id,
|
|
trust_level: user.trust_level,
|
|
issued_at: 5.minutes.ago,
|
|
)
|
|
|
|
env = create_request_env(path: "/test").merge(
|
|
"HTTP_COOKIE" => "_t=#{cookie};"
|
|
)
|
|
expect(CurrentUser.lookup_from_env(env)).to eq(user)
|
|
end
|
|
|
|
end
|