Sha256: aa0609479d7135698faf219e23fc5599b5c026d38cf85039775cd2651c73d1bb

Contents?: true

Size: 903 Bytes

Versions: 65

Compression:

Stored size: 903 Bytes

Contents

require "spec_helper"

describe SC::HashStruct, 'has_options?' do

  include SC::SpecHelpers

  before do
    @hash = SC::HashStruct.new :foo => :foo, :bar => :bar
  end

  it "always returns true if passed match is empty or nil" do
    @hash.has_options?.should be_true
    @hash.has_options?({}).should be_true
  end

  it "returns true if every key/value pair in passed value set matches" do
    @hash.has_options?(:foo => :foo, :bar => :bar).should be_true
  end

  it "returns false if any key/value pair in passed value set does not match" do
    @hash.has_options?(:foo => :foo, :bar => :no_match).should be_false
  end

  it "returns false if any key/value pair does not exist in hash" do
    @hash.has_options?(:imaginary => true).should be_false
  end

  it "returns treats strings + symbols the same for keys" do
    @hash.has_options?('foo' => :foo, 'bar' => :bar).should be_true
  end

end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
sproutcore-1.11.0 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.11.0.rc3 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.11.0.rc2 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.11.0.rc1 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.10.3.1 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.10.2 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.10.1 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.10.0 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.10.0.rc.3 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.10.0.rc.2 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.10.0.rc.1 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.9.2 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.9.1 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.9.0 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.8.2.1 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.8.1 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.8.0 spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.7.1.beta-java spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.7.1.beta spec/lib/models/hash_struct/has_options_spec.rb
sproutcore-1.6.0.1-java spec/lib/models/hash_struct/has_options_spec.rb