Skip to content

Commit

Permalink
Add specs to show save! supports string keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Mar 29, 2018
1 parent bd00996 commit 1b8cd76
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/lib/vmdb/settings_spec.rb
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 1b8cd76

Please sign in to comment.