Skip to content

Commit

Permalink
Merge pull request #17238 from Fryguy/settings_support_string_keys
Browse files Browse the repository at this point in the history
Add specs to show save! supports string keys
  • Loading branch information
gtanzillo authored Mar 30, 2018
2 parents 317ba02 + 1b8cd76 commit 43dca86
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/lib/vmdb/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,28 @@
)
end

it "with a change with string keys" do
described_class.save!(miq_server, "api" => {"token_ttl" => "1.hour"})

miq_server.reload
expect(miq_server.settings_changes.count).to eq 1
expect(miq_server.settings_changes.first).to have_attributes(
:key => "/api/token_ttl",
:value => "1.hour"
)
end

it "with a change with mixed keys" do
described_class.save!(miq_server, "api" => {:token_ttl => "1.hour"})

miq_server.reload
expect(miq_server.settings_changes.count).to eq 1
expect(miq_server.settings_changes.first).to have_attributes(
:key => "/api/token_ttl",
:value => "1.hour"
)
end

it "with a previous change, now back to the default" do
default = Settings.api.token_ttl
miq_server.settings_changes.create!(:key => "/api/token_ttl", :value => "1.hour")
Expand Down

0 comments on commit 43dca86

Please sign in to comment.