Ruby on Rails
Tuesday, July 22, 2014
On Tuesday, July 22, 2014 1:08:08 AM UTC+2, Sjouke Fikse wrote:
I'm trying to create an instance of a class in a spec file, but I'm failing to do this.These two files exists:app/models/street.rbspec/models/street_spec.rbWithin street_spec.rb, I'm trying to create a new instance of the street class, but it doesn'tknow what street is. That's acceptable, but when I add `require 'streets'` and it still fails:$ rspec spec/models/street_spec.rb/home/sjouke/streetmap/spec/models/street_spec.rb:2:in `require': cannot load such file -- street (LoadError) from /home/sjouke/streetmap/spec/models/street_spec.rb:2:in `<top (required)>' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/ configuration.rb:1057:in `load' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/ configuration.rb:1057:in `block in load_spec_files' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/ configuration.rb:1057:in `each' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/ configuration.rb:1057:in `load_spec_files' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/runner. rb:97:in `setup' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/runner. rb:85:in `run' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/runner. rb:70:in `run' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/lib/rspec/core/runner. rb:38:in `invoke' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/gems/rspec-core- 3.0.2/exe/rspec:4:in `<top (required)>' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/bin/rspec:23:in `load' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/bin/rspec:23:in `<main>' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/bin/ruby_ executable_hooks:15:in `eval' from /home/sjouke/.rvm/gems/ruby-2.1.2@streetmap/bin/ruby_ executable_hooks:15:in `<main>' Any idea why it wouldn't be loading the file appropriately?Also, I'm using using rspec-rails after a suggestion from somebody in IRC.
You should have smth liek that in your street_spec.rb:
require 'spec_helper'
describe Street do
describe 'whatever you want' do
before { @street = Street.new}
it 'has something to check' do
end
end
end
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4abcbd9e-57b7-49ba-9d24-d4dcd831b203%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment