Sha256: 22983dbba7a25018914a498a031cedb4c28fda8cc81fc8f0d818dd56e567c00b

Contents?: true

Size: 1.04 KB

Versions: 15

Compression:

Stored size: 1.04 KB

Contents

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

describe "UtilsSpec" do
  include Utils
  include Logging

  include_examples "BenchSpecHelper"

  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'}}
    Bench::Utils.should_not_receive(:bench_log)
    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'}}
    compare_and_log(h1,h2,'the caller').should == 1
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rhoconnect-7.6.0 bench/spec/utils_spec.rb
rhoconnect-7.5.1 bench/spec/utils_spec.rb
rhoconnect-7.4.1 bench/spec/utils_spec.rb
rhoconnect-7.1.17 bench/spec/utils_spec.rb
rhoconnect-6.2.0 bench/spec/utils_spec.rb
rhoconnect-6.0.11 bench/spec/utils_spec.rb
rhoconnect-5.5.18 bench/spec/utils_spec.rb
rhoconnect-5.5.17 bench/spec/utils_spec.rb
rhoconnect-5.5.15 bench/spec/utils_spec.rb
rhoconnect-5.5.0.22 bench/spec/utils_spec.rb
rhoconnect-5.5.2 bench/spec/utils_spec.rb
rhoconnect-5.5.0.7 bench/spec/utils_spec.rb
rhoconnect-5.5.0.3 bench/spec/utils_spec.rb
rhoconnect-5.5.0 bench/spec/utils_spec.rb
rhoconnect-5.1.1 bench/spec/utils_spec.rb