Hello Jon, Reboot fixed it. :)
On Wednesday, December 16, 2015 at 6:07:13 AM UTC+5:30, Jon Rowe wrote: > > Try requiring the files manually, Rails autoloading is sometimes a bit > funny. > > Jon Rowe > --------------------------- > [email protected] <javascript:> > jonrowe.co.uk > > On Tuesday, 15 December 2015 at 23:19, Arup Rakshit wrote: > > Hi, > > I have very similar index action test pattern in 100+ controllers. That is > why I am thinking to run them from a single file. Here is my code to meet > the same need : > > require 'spec_helper' > > Dir[Rails.root.join('app','admin', '**', '*')].each do | file_name | > admin_controller = File.basename(file_name, '.rb') > > RSpec.describe "Admin::#{ admin_controller.classify > }sController".constantize, type: :controller do > render_views > > let(:login_with) { create(:full_admin_user) } > > login_admin_user > > include_examples "index" > end > end > > > But, once I run it, getting below error : > > > /Users/arup/.rvm/gems/ruby-2.2.3@admin/gems/activesupport-4.2.5/lib/active_support/inflector/methods.rb:263:in > `const_get': uninitialized constant Admin::AccountingsController (NameError) > from > /Users/arup/.rvm/gems/ruby-2.2.3@admin/gems/activesupport-4.2.5/lib/active_support/inflector/methods.rb:263:in > `block in constantize' > from > /Users/arup/.rvm/gems/ruby-2.2.3@admin/gems/activesupport-4.2.5/lib/active_support/inflector/methods.rb:259:in > `each' > from > /Users/arup/.rvm/gems/ruby-2.2.3@admin/gems/activesupport-4.2.5/lib/active_support/inflector/methods.rb:259:in > `inject' > from > /Users/arup/.rvm/gems/ruby-2.2.3@admin/gems/activesupport-4.2.5/lib/active_support/inflector/methods.rb:259:in > `constantize' > from > /Users/arup/.rvm/gems/ruby-2.2.3@admin/gems/activesupport-4.2.5/lib/active_support/core_ext/string/inflections.rb:66:in > `constantize' > from > /Users/arup/eligible/admin/spec/controllers/controller_index_action_spec.rb:7:in > `block in <top (required)>' > from > /Users/arup/eligible/admin/spec/controllers/controller_index_action_spec.rb:4:in > `each' > from > /Users/arup/eligible/admin/spec/controllers/controller_index_action_spec.rb:4:in > `<top (required)>' > > > Those test are for ActiveAdmin controllers. When I run the same test as below > : > > > require 'spec_helper' > > RSpec.describe Admin::AccountingsController, type: :controller do > render_views > > let(:full_admin_user) { create(:full_admin_user) } > let(:login_with) { full_admin_user } > > login_admin_user > > include_examples "index" > end > > > > It works like a charm. Now my question is why the code given at top of this > thread didn't work ? > > -- > 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] <javascript:>. > To post to this group, send email to [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rspec/a5f0915a-870e-4595-a600-45134bbe9546%40googlegroups.com > > <https://groups.google.com/d/msgid/rspec/a5f0915a-870e-4595-a600-45134bbe9546%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- 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/de21df76-d5f7-462e-b8ac-4c5c12608ea7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
