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

LesFreeman lesliefreeman3 at gmail.com
Mon Nov 22 15:42:17 EST 2010


I too am having this error

On Sep 28, 10:42 pm, Amiruddin Nagri <amir.na... at gmail.com> wrote:
> I am having a shared example 'allow authorized actions' for my Rails 3 RSpec
> 2.beta.20 application. The shared example looks like
>
> share_examples_for 'allow authorized actions' do
>   ...
> end
>
> This shared example is 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': Shared example group 'allow
> authorized actions' already exists (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 include shared example files 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


More information about the rspec-users mailing list