mardi 28 avril 2015

uninitialized constant file in subfolder

My test folder is structured like this:

  test
    models
      restaurant
        helpers
           employee.rb
        points_test.rb

So my PointsTest looks like this:

require 'models/restaurant/helpers/employee.rb' 

   class Restaurant::PointsTest < ActiveSupport::TestCase
     ....
     employee1 = Restaurant::Employee.create

And the file Employee like this:

class Restaurant::Employee
   def self.create
     .....

Everything works like this

---------------------------------------------

Now i tried to change class Restaurant::Employee to class Restaurant::Helpers::Employee

and in PointsTest i changed to employee1 = Restaurant::Helpers::Employee.create

And I get this error:

uninitialized constant Restaurant::Helpers (NameError)

What do I wrong? I mean Helpers is in the subfolder helpers! Thank you

Aucun commentaire:

Enregistrer un commentaire