Sha256: e153eb857a4f600ef7e13658ce24d8906254ed8999046d4e6aadff71592e4aa8

Contents?: true

Size: 1.09 KB

Versions: 49

Compression:

Stored size: 1.09 KB

Contents

$:.unshift File.join(File.dirname(__FILE__))
require 'bench_spec_helper'

describe "UtilsSpec" do
  it_should_behave_like "BenchSpecHelper"
  include Utils
  include Logging
  
  it "should compare two identical hashes" do
    h1 = {'key1' => {'key2' => 'value2'}}
    h2 = {'key1' => {'key2' => 'value2'}}
    compare(:expected,h1,:actual,h2).should == []
  end
  
  it "should compare two different hashes" do
    h1 = {'key1' => {'key2' => 'value2'}}
    h2 = {'key1' => {'key2' => 'value3'}}
    compare(:expected,h1,:actual,h2).should == 
      [{:actual=>"value3", :path=>["key1", "key2"], :expected=>"value2"}]
  end
  
  it "should compare_and_log two identical hashes" do
    h1 = {'key1' => {'key2' => 'value2'}}
    h2 = {'key1' => {'key2' => 'value2'}}
    logger.should_not_receive(:error)
    compare_and_log(h1,h2,'the caller').should == 0
  end
  
  it "should compare_and_log two different hashes" do
    h1 = {'key1' => {'key2' => 'value2'}}
    h2 = {'key1' => {'key2' => 'value3'}}
    logger.should_receive(:error).exactly(5).times
    compare_and_log(h1,h2,'the caller').should == 1
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
rhosync-2.1.18.beta2 bench/spec/utils_spec.rb
rhosync-2.1.18.beta1 bench/spec/utils_spec.rb
rhosync-2.1.17 bench/spec/utils_spec.rb
rhosync-2.1.17.beta7 bench/spec/utils_spec.rb
rhosync-2.1.17.beta6 bench/spec/utils_spec.rb
rhosync-2.1.17.beta5 bench/spec/utils_spec.rb
rhosync-2.1.17.beta4 bench/spec/utils_spec.rb
rhosync-2.1.17.beta3 bench/spec/utils_spec.rb
rhosync-2.1.17.beta2 bench/spec/utils_spec.rb
rhosync-2.1.17.beta1 bench/spec/utils_spec.rb
rhosync-2.1.16 bench/spec/utils_spec.rb
rhosync-2.1.15 bench/spec/utils_spec.rb
rhosync-2.1.14 bench/spec/utils_spec.rb
rhosync-2.1.13 bench/spec/utils_spec.rb
rhosync-2.1.12 bench/spec/utils_spec.rb
rhosync-2.1.11 bench/spec/utils_spec.rb
rhosync-2.1.10 bench/spec/utils_spec.rb
rhosync-2.1.7 bench/spec/utils_spec.rb
rhosync-2.1.6 bench/spec/utils_spec.rb
rhosync-2.1.3 bench/spec/utils_spec.rb