On Thu, Aug 6, 2009 at 3:56 PM, Sam Falvo<sfalvo at ning.com>
wrote:> I hope nobody takes this message too curtly -- I''m just trying to
be as
> brief, and yet as informative, as possible, as per the guidelines on the
> RSpec contact website.
>
> Can anyone assist? ?Thanks!
>
> ### Problem:
>
> Potential bug in RSpec. ?nil#should always passes the test. ?It should
> succeed if, and only if, its boolean expression is true, as it would for
any
> other expression.
>
> To reproduce, please find multiplexed in this message the following
> components:
>
> * phased_version_spec.rb file contents
> * phased_version.rb file contents
> * RSpec version
> * Command executed to reproduce the error
> * Generated output.
> * Expectations.
> * Gem listing.
>
>
> ### In file phased_version_spec.rb:
>
> #!/usr/bin/env spec
>
> require ''phased_version''
>
> module M
> ? ?describe M::PhasedVersion, "freshly created" do
> ? ? ? ?before(:each) do
> ? ? ? ? ? ?@v = M::PhasedVersion.new
> ? ? ? ?end
>
> ? ? ? ?it "should parse a phase" do
> ? ? ? ? ? ?@v.parse_string("6.16.7-pre")
> ? ? ? ? ? ?(@v.phase).should.eql? "pre"
This needs to read:
(@v.phase).should eql("pre")
What you have does not set any expectation, therefore there is nothing to fail.
HTH,
David
> ? ? ? ? ? ?# HUH?
> ? ? ? ? ? ?# (@v.phase = nil) implies ((@v.phase).should.eql?
"pre") > (nil.should.eql? "pre") implies (this should
fail the test!)
> ? ? ? ?end
> ? ?end
> end
>
> ### In file phased_version.rb:
>
> #!/usr/bin/env ruby
>
> module M
> ? ?class PhasedVersion
> ? ? ? ?def parse_string aString
> ? ? ? ? ? ?@str = aString
> ? ? ? ?end
>
> ? ? ? ?attr_reader :phase
>
> ? ? ? ?def initialize
> ? ? ? ? ? ?@str = nil
> ? ? ? ? ? ?@phase = nil
> ? ? ? ?end
> ? ?end
> End
>
> ### RSpec Version: 1.2.7
>
> ### Command: spec phased_version_spec.rb
>
> ### No errors generated; indeed, this is the problem!
>
> ### Output:
> .
>
> Finished in 0.010082 seconds
>
> 1 example, 0 failures
>
>
> ### Expected:
> F
> (diagnostic here)
>
> Finished in ... Seconds
> 1 example, 1 failures
>
>
> ### gem listing
> *** LOCAL GEMS ***
>
> actionmailer (1.3.6)
> actionpack (1.13.6)
> actionwebservice (1.2.6)
> activerecord (1.15.6)
> activesupport (1.4.4)
> acts_as_ferret (0.4.1)
> capistrano (2.0.0)
> cgi_multipart_eof_fix (2.5.0)
> daemons (1.0.9)
> dnssd (0.6.0)
> fastthread (1.0.1)
> fcgi (0.8.7)
> ferret (0.11.4)
> gem_plugin (0.2.3)
> highline (1.2.9)
> hpricot (0.6)
> libxml-ruby (0.9.5, 0.3.8.4)
> mongrel (1.1.4)
> needle (1.3.0)
> net-sftp (1.1.0)
> net-ssh (1.1.2)
> rails (1.2.6)
> rake (0.8.7, 0.7.3)
> RedCloth (3.0.4)
> rspec (1.2.7)
> ruby-openid (1.1.4)
> ruby-yadis (0.3.4)
> rubyforge (1.0.3)
> rubygems-update (1.3.4)
> rubynode (0.1.3)
> sqlite3-ruby (1.2.1)
> systemu (1.2.0)
> term-ansicolor (1.0.3)
> termios (0.9.4)
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>