Sha256: 0f45597464413488fae51041af467970478dcffd1f16ef6bab1c66a2eadd3baf
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'rspec' require 'rspec-deep-ignore-order-matcher' describe Deep::Ignore::Order::Matcher do it 'should matches usual values' do ['an_string', 1, 13.5, nil, [1, 2, 3], { :a => 1, :b => 2 }].each_slice(2) do |value1, value2| value1.should be_deep_equal value1 value2.should be_deep_equal value2 value1.should_not be_deep_equal value2 value2.should_not be_deep_equal value1 end end it 'should ignore order in plain arrays' do actual = Array.new(5) { Random.rand(1000) } expected = actual.sort actual.should be_deep_equal expected end it 'should match deep structs' do actual = [{ :a => 1, :b => 'str', :c => [1, 2, 3] }, [{ :a => [2, { :a => 4 }] }, { :b => 2 }, { :c => 3 }]] expected = [{ :a => 1, :b => 'str', :c => [3, 1, 2] }, [{ :b => 2 }, { :a => [{ :a => 4 }, 2] }, { :c => 3 }]] actual.should be_deep_equal expected actual[0][:c].push(4) actual.should_not be_deep_equal expected end it 'should do not match partials' do [1, 2, 3].should_not be_deep_equal [1, 2] [1, 2].should_not be_deep_equal [1, 2, 3] { :a => 1, :b => 2 }.should_not be_deep_equal({ :a => 1 }) { :a => 1 }.should_not be_deep_equal({ :a => 1, :b => 2 }) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec-deep-ignore-order-matcher-0.0.1 | spec/matcher_spec.rb |