You should remove the line 'require "street"'.
On 22 July 2014 17:05, Sjouke Fikse <sjouke.fi...@gmail.com> wrote: > Hi Javix, I did run rails generate rspec:install. I forgot to mention that. > > Here's the output of the files I mentioned: > > $ cat spec/models/street_spec.rb > > require "spec_helper" > require "street" > > describe "a street" do > it "can be created" do > Street.new > end > end > > > $ cat app/models/street.rb > > class Street < ActiveRecord::Base > attr_accessor :coordinates > end > > > On Tuesday, July 22, 2014 3:05:39 AM UTC-5, Javix wrote: >> >> >> >> 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.rb >>> >>> spec/models/street_spec.rb >>> >>> Within street_spec.rb, I'm trying to create a new instance of the street >>> class, but it doesn't >>> know 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. >>> >> >> 1. Please, post your street_spec.rb file content. >> 2. Did you run rails generate rspec:install ? >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/rubyonrails-talk/6sAHBn-KzNo/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > rubyonrails-talk+unsubscr...@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/d502f3e7-5078-427f-9e5b-7767c301d78d%40googlegroups.com > <https://groups.google.com/d/msgid/rubyonrails-talk/d502f3e7-5078-427f-9e5b-7767c301d78d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@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/CAJGQ%3Dvae3f89fDJv1kVDoP_VsC7NrRi7WE27xh1FnqWKXF5pyA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.