mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 08:30:12 +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
28 lines
637 B
Ruby
28 lines
637 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe SecureSession do
|
|
it "operates correctly" do
|
|
s = SecureSession.new("abc")
|
|
|
|
s["hello"] = "world"
|
|
s["foo"] = "bar"
|
|
expect(s["hello"]).to eq("world")
|
|
expect(s["foo"]).to eq("bar")
|
|
|
|
s["hello"] = nil
|
|
expect(s["hello"]).to eq(nil)
|
|
end
|
|
|
|
it "can override expiry" do
|
|
s = SecureSession.new("abc")
|
|
key = SecureRandom.hex
|
|
|
|
s.set(key, "test2", expires: 5.minutes)
|
|
expect(s.ttl(key)).to be_within(1.second).of (5.minutes)
|
|
|
|
key = SecureRandom.hex
|
|
s.set(key, "test2")
|
|
expect(s.ttl(key)).to be_within(1.second).of (SecureSession.expiry)
|
|
end
|
|
end
|