lundi 26 octobre 2015

RSpec does not see classes from /custom rails directory

I've created my own service (which is Plain Old Ruby Object) in app/services/nested/auth_service.rb. Of course I decided to write tests for it, so I created file in RSpec under spec/services/nested/auth_service_spec.rb and wrote inside:

require 'spec_helper'

RSpec.describe Nested::Auth do
end

I added spec_helper because Nested::Auth is just PORO without any rails stuff inside (so rails_helper would be overkill here, right?)

Unfortunately while running rspec command I got error: uninitialized constant Nasted::Auth

I added $: << '../app/services' at the top of spec_helper.rb but didn't help. $: << '../services' also didn't work.

How to let spec_helper see /services directory? How to fix uninitialized constant error?

Aucun commentaire:

Enregistrer un commentaire