Skip to content

Commit

Permalink
Add specs to test hash within different access
Browse files Browse the repository at this point in the history
  • Loading branch information
allenwq committed May 25, 2015
1 parent e2e3bb9 commit b5ded1f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/settings_on_rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,15 @@
let(:text) { 'SETTINGS ON RAILS' }
context 'assign a new key to settings' do
let(:settings_object) { blog.settings(:key1, :key2) }
before { settings_object.settings(:key3).value = text }
before { settings_object.settings(:key3).title = text }

it 'operates on the hash object when passing a block' do
expect(settings_object.any? {|key, value| key == 'key3' }).to eq true
expect(settings_object.settings(:key3).any? {|key, value| key == 'value' }).to eq true
end

it 'is a hash within different access object' do
expect((settings_object.map {|key, value| value }).first).
to be_instance_of ActiveSupport::HashWithIndifferentAccess
end
end
end
Expand Down

0 comments on commit b5ded1f

Please sign in to comment.