[rspec-devel] [ rspec-Bugs-11584 ] Different results for 'rspec' and 'rcov' task in handling hashes.

noreply at rubyforge.org noreply at rubyforge.org
Thu Jun 28 10:37:59 EDT 2007


Bugs item #11584, was opened at 2007-06-14 18:05
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11584&group_id=797

Category: expectation module
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 3
Submitted By: Christian Kebekus (ckatorial)
Assigned to: Nobody (None)
Summary: Different results for 'rspec' and 'rcov' task in handling hashes.

Initial Comment:
There seems to be a difference between running the spec and the rcov task. As much as I can figure, the access to a hash is not consistent. The spec task returns/iterates through the hash the expected way, while the rcov task does not. 


= Example

See attached file for example.

$ rake spec
(in /Temp)
.

Finished in 0.019277 seconds

1 example, 0 failures


$ rake rcov
(in /Temp)
F

1)
Spec::Mocks::MockExpectationError in 'The Business Unit Filter with Single Filter Condition should not filter patient with matching only partial fields of business unit'
Mock 'patient business unit' expected :key with (any args) once, but received it 0 times
./spec/filters/business_unit_filter_spec.rb:8:

Finished in 0.008152 seconds


1 example, 1 failure


= Environment

$ ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1]

$ gem -v
0.9.4

$ rake --version
rake, version 0.7.3

$ gem list | grep rspec
rspec (1.0.5)
    RSpec-1.0.5 (r2081) - BDD for Ruby http://rspec.rubyforge.org/

$ gem list | grep rcov 
rcov (0.8.0.2)

----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-06-28 10:37

Message:
Ruby iterates over elements in a Hash in an arbitrary order.

If things behave differently with and without RCov it only means that this arbitraryness has bitten you. It has nothing to do with RSpec. 

Your spec is making unreasonable assumptions about Hash iteration ordering, that's all.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11584&group_id=797


More information about the rspec-devel mailing list