Sha256: e6d72bf62f5e663b9dd04d9b70fe1c2363601d6fba1351de8751cd51b68c5548
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' require 'state_mate/adapters/defaults' describe "StateMate::Adapters::Defaults.read" do include_context "defaults" include_context "#{ DOMAIN } empty" let(:key) { 'x' } it "returns nil when the key is missing" do expect( defaults.read [DOMAIN, key] ).to be nil end it "reads boolean values as a booleans (not ints)" do bools = { 't' => [true, 1], 'f' => [false, 0], } bools.each {|key, (bool, int)| # write boolean values `defaults write #{ DOMAIN } #{ key } -boolean #{ bool }` # when it's read by `defaults read`, it says it's a boolean # but it returns it as an integer expect_defaults_read key, eq(int.to_s), 'boolean' # however, since we use `defaults export` it reads it correctly # as a boolean expect( defaults.read [DOMAIN, key] ).to be(bool) } end context "string value with @ in it" do let(:string) { 'en_US@currency=USD' } before(:each) { `defaults write #{ DOMAIN } #{ key } -string '#{ string }'` } it "reads a string with an @ in it" do expect( defaults.read [DOMAIN, key] ).to eq string end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
state_mate-0.0.3 | spec/state_mate/adapters/defaults/read_spec.rb |
state_mate-0.0.2 | spec/state_mate/adapters/defaults/read_spec.rb |