-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
FakeIdp.reset!
method to reset configuration state
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,8 @@ def self.configuration | |
def self.configure | ||
yield(configuration) | ||
end | ||
|
||
def self.reset! | ||
@configuration = nil | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require "spec_helper" | ||
|
||
describe FakeIdp do | ||
describe "#configure" do | ||
describe ".configure" do | ||
context 'valid configuration' do | ||
before do | ||
FakeIdp.configure do |config| | ||
|
@@ -61,4 +61,39 @@ | |
end | ||
end | ||
end | ||
|
||
describe ".reset!" do | ||
before do | ||
FakeIdp.configure do |config| | ||
config.callback_url = "http://localhost.dev:3000/auth/saml/devidp/callback" | ||
config.sso_uid = "12345" | ||
config.username = "bobthessouser" | ||
config.name_id = "[email protected]" | ||
config.additional_attributes = { foo: "bar" } | ||
end | ||
|
||
FakeIdp.reset! | ||
end | ||
|
||
it "resets the callback_url" do | ||
expect(FakeIdp.configuration.callback_url). | ||
not_to eq("http://localhost.dev:3000/auth/saml/devidp/callback") | ||
end | ||
|
||
it "resets the sso_uid" do | ||
expect(FakeIdp.configuration.sso_uid).not_to eq("12345") | ||
end | ||
|
||
it "resets the username" do | ||
expect(FakeIdp.configuration.username).not_to eq("bobthessouser") | ||
end | ||
|
||
it "resets the name_id" do | ||
expect(FakeIdp.configuration.name_id).not_to eq("[email protected]") | ||
end | ||
|
||
it "resets the additional_attributes" do | ||
expect(FakeIdp.configuration.additional_attributes).not_to eq({ foo: "bar" }) | ||
end | ||
end | ||
end |