I have a class inside app/models/parser called data.rb with the contents:
class Parser::Data def method1 end end
Nothing special at the moment. I am trying to write a test for it, before I implement too much, I just installed RSpec for Rails.
My RSpec file is located in spec/models/parser/data_spec.rb and is very simple:
require 'spec_helper.rb' describe Parser::Data do let(:parser) { Parser::Data.new } end
When I run the test, I get this error:
spec/models/parser/data_spec.rb:3:in `<top (required)>': uninitialized constant Parser (NameError)
I tried to place the module Parser around the Data class in the same directory app/models/parser , I also tried to move it to lib/parser , doing the same module packaging class, and added lib/parser to autoload in application.rb , but nothing yet not done.
What am I doing wrong?
ruby ruby-on-rails ruby-on-rails-4 rspec rspec-rails
Gandalf StormCrow Apr 19 '16 at 2:54 on 2016-04-19 14:54
source share