[rspec-users] rspec and should eql

David Chelimsky dchelimsky at gmail.com
Tue Sep 6 06:44:23 EDT 2011


On Sep 5, 2011, at 11:27 PM, slavix wrote:

> Here is another example that is failing due to same problem..
> 
> class Currency < ActiveRecord::Base
> end
> 
> class Bitcoin < Currency
>  include ActiveRecord::Singleton
>  default_scope where(:char_code => 'BTC')
> end
> 
> 
> spec:
> describe Bitcoin do
> ..
>  Bitcoin.instance.char_code.should eql('BTC')

The describe() method creates an example group, and the it() method creates an example. This ^^ line needs to be in an example:

describe Bitcoin do
  it "defaults to BTC for char_code" do
    Bitcoin.instance.char_code.should eq('BTC')
  end
end

re: whether to use eq, eql, or equal, see http://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/equality-matchers

HTH,
David

> ..
> end
> 
> error:
> /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/remarkable-4.0.0.alpha4/lib/
> remarkable/core/macros.rb:15:in `method_missing': undefined method
> `eql' for #<Class:0xe314990> (NoMethodError)



More information about the rspec-users mailing list