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"
on 2011-09-06 03:13
on 2011-09-06 06:07
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.
on 2011-09-06 06:22
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/Spe...
on 2011-09-06 07:13
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 2011-09-06 12:57
On Sep 5, 2011, at 11:27 PM, slavix wrote: > > 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... HTH, David
on 2011-09-06 14:09
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/Spe... This 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
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.