Having troubles with rspec and should eql.. in a rails 3.1 app spec has this User.first.name.should eql(''admin'') get this error .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:0xf51ab30> (NoMethodError) btw, I am using gem "rspec" gem "rspec-rails" gem "remarkable_activerecord", "~> 4.0.0.alpha4" gem ''rspec-rails-ext'' gem ''rspec-rails-matchers'' gem "cucumber-rails" gem "webrat" gem "capybara" gem "mocha" gem "rcov" gem "faker" gem "shoulda-matchers"
Try "eq" or "equal". -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110905/1e736a9f/attachment.html>
thanks. tried both with same result. btw documentation says to use eql 5.should eql(5) http://rspec.rubyforge.org/rspec/1.1.9/classes/Spec/Matchers.html#M000429 On Sep 5, 7:08?pm, Nick <n... at deadorange.com> wrote:> Try "eq" or "equal".
On Sep 5, 2011, at 8:10 PM, slavix wrote:> Having troubles with rspec and should eql.. in a rails 3.1 app > > spec has this > User.first.name.should eql(''admin'') > > get this error > .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:0xf51ab30> (NoMethodError)Please post the example that is failing and the full error message.
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'') .. 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) from /home/slava/dev/projects/bitcoin-derivatives/spec/models/ bitcoin_spec.rb:4:in `block in <top (required)>'' from /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.6.4/lib/ rspec/core/example_group.rb:142:in `module_eval'' from /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.6.4/lib/ rspec/core/example_group.rb:142:in `subclass'' from /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.6.4/lib/ rspec/core/example_group.rb:129:in `describe'' from /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.6.4/lib/ rspec/core/dsl.rb:5:in `describe'' from /home/slava/dev/projects/bitcoin-derivatives/spec/models/ bitcoin_spec.rb:3:in `<top (required)>''
On Sep 5, 2011, at 9:34 PM, slavix wrote:> thanks. tried both with same result. > btw documentation says to use eql > > 5.should eql(5) > http://rspec.rubyforge.org/rspec/1.1.9/classes/Spec/Matchers.html#M000429This is not why you''re having trouble, but rspec-1.1.9 is nearly three years old: http://rubygems.org/gems/rspec/versions/1.1.9. See http://relishapp.com/rspec and http://rubydoc.info/gems/rspec/frames for the latest. Cheers, David
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)