Skip to content

Commit

Permalink
small update
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Nov 15, 2023
1 parent 935cae6 commit eec1cca
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions spec/mangopay/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
valid_config.preproduction = true

# add the 2 configs to the list of MangoPay configs
MangoPay::add_config('wrong', wrong_config)
MangoPay::add_config('valid', valid_config)
MangoPay.add_config('wrong', wrong_config)
MangoPay.add_config('valid', valid_config)

# apply wrong config
MangoPay::get_config('wrong').apply_configuration
MangoPay.get_config('wrong').apply_configuration

expect {
MangoPay::User.fetch()
Expand All @@ -42,7 +42,7 @@
}

# apply valid configuration
MangoPay::get_config('valid').apply_configuration
MangoPay.get_config('valid').apply_configuration

# expect success
users = MangoPay::User.fetch()
Expand All @@ -51,7 +51,7 @@

it 'fails when fetching a config that does not exist' do
expect {
MangoPay::get_config('placeholder')
MangoPay.get_config('placeholder')
}.to raise_error { |err|
expect(err).to be_a RuntimeError
expect(err.message).to eq "Could not find any configuration with name 'placeholder'"
Expand All @@ -64,17 +64,17 @@
wrong_config.client_apiKey = '0000'
wrong_config.preproduction = true

MangoPay::add_config('wrong', wrong_config)
MangoPay.add_config('wrong', wrong_config)

# pass when fetching config before removing it
MangoPay::get_config('wrong')
MangoPay.get_config('wrong')

# remove config
MangoPay::remove_config('wrong')
MangoPay.remove_config('wrong')

# fail when trying to fetch after removal
expect {
MangoPay::get_config('wrong')
MangoPay.get_config('wrong')
}.to raise_error { |err|
expect(err).to be_a RuntimeError
expect(err.message).to eq "Could not find any configuration with name 'wrong'"
Expand Down

0 comments on commit eec1cca

Please sign in to comment.