On Wednesday, February 3, 2016 at 4:05:43 PM UTC+1, Javix wrote:
>
> I can't figure out why when I run all the tests with
> rspec
>
> command, they all are run.
>
> If I run a helper spec separately like that:
>
> rspec spec/helpers/application_helper_spec.rb
>
>
> it fails as follows:
> spec/helpers/application_helper_spec.rb:3:in `<top (required)>':
> uninitialized constant ApplicationHelper (NameError)
>
>
>
> from
> /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in
>
> `load'
>
> from
> /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in
>
> `block in load_spec_files'
>
> from /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/
> rspec/core/configuration.rb:1325:in `each'
>
> from
> /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in
>
> `load_spec_files'
>
> from
> /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:102:in
>
> `setup'
>
> from /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/
> rspec/core/runner.rb:88:in `run'
>
> from
> /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in
>
> `run'
>
> from
> /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in
>
> `invoke'
>
> from /Users/serge-mac/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.2/exe/
> rspec:4:in `<top (required)>'
>
> from /Users/serge-mac/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `load'
>
> from /Users/serge-mac/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `<main>'
>
> from /Users/serge-mac/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:
> in `eval'
>
>
>
> from
> /Users/serge-mac/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in
> `<main>'
>
>
>
> Here is the application_helper_spec.rb:
>
>
> equire 'spec_helper'
>
>
> describe ApplicationHelper, :type => :helper do
>
> describe "generating full title" do
>
> let(:base_title) { I18n.t(:base_title)}
>
> it "should concatenate page title with base title" do
>
> expect(full_title('some page title')).to eq("#{base_title} | some
> page title")
>
> end
>
> ...
>
> end
>
> end
>
>
>
> Figured out myself.
That was a wrong copy-paste from an old project: instead of requiring
*spec_helper* (which fails), I had to change it to require r*ails_helper*
and it worked. :)
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/c0554588-eb71-431f-8209-612f1649ef88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.