[rspec-users] autotest giving error when having shared example in specs

Rob Westgeest rob.westgeest at gmail.com
Fri Jan 21 05:57:50 EST 2011


I am having the same problem.

Autotest with rspec seem to differ from rspecs rake task in which
files to automatically require.

The rake task requires spec/**/*.spec
Autotest rspec2 requires spec/**/*

As I am sharing example groups in their own files names
(shared_*_examples.rb), and require them from *spec.rb files, rake
works nicely and autotest fails because of its 'lets require
everything' attitude.

I presume that there is a way to configure autotests require set, but
i haven't found it yet.

Anyone?

On Nov 22 2010, 9:42 pm, LesFreeman <lesliefreem... at gmail.com> wrote:
> I too am having this error
>
> On Sep 28, 10:42 pm, Amiruddin Nagri <amir.na... at gmail.com> wrote:
>
> > I am having asharedexample'allow authorized actions' for my Rails 3 RSpec
> > 2.beta.20 application. Thesharedexamplelooks like
>
> > share_examples_for 'allow authorized actions' do
> >   ...
> > end
>
> > Thissharedexampleis in file
> > spec/controllers/support/authorization_shared_example.rb, which I am
> > requiring in spec_helper.rb. I am also using autotest to give me quick
> > feedback. Autotest is generating following command to run rspec
>
> > <path to
> > ruby>/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/bin/rspec <path
> > to rails root>/spec/controllers/support/authorization_shared_example.rb
> > <other spec files>
>
> > Since autotest is also including support file when running rspec, I am
> > getting following errors with autotest
>
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/shared_example_group.rb:43:in
> > `ensure_shared_example_group_name_not_taken':Sharedexamplegroup'allow
> > authorized actions'alreadyexists(ArgumentError)
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/shared_example_group.rb:6:in
> > `share_examples_for'
> >     from
> > /Users/arusarh/work/ece/carbonomist/spec/controllers/support/authorization_ shared_example.rb:1:in
> > `<top (required)>'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_ support/dependencies.rb:235:in
> > `load'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_ support/dependencies.rb:235:in
> > `block in load'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_ support/dependencies.rb:227:in
> > `load_dependency'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_ support/dependencies.rb:235:in
> > `load'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/configuration.rb:302:in
> > `block in load_spec_files'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/configuration.rb:302:in
> > `map'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/configuration.rb:302:in
> > `load_spec_files'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/command_line.rb:18:in
> > `run'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/runner.rb:46:in
> > `run_in_process'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/runner.rb:37:in
> > `run'
> >     from
> > /Users/arusarh/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.0.0.beta.20/lib/rs pec/core/runner.rb:10:in
> > `block in autorun'
>
> > Any ideas how to not make autotest includesharedexamplefiles loaded
> > through command line, but only include files with pattern "*_spec.rb", or
> > have anyone else facing same situation.
>
> > Regards,
> > Amiruddin Nagri,
> > Bangalore, 560008, KA
> > India
>
> > Y! IM : amir_na... at yahoo.com
> > GTalk : amir.na... at gmail.com
>
> > _______________________________________________
> > rspec-users mailing list
> > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list