Hi, Thanks for quick response
My channels_controller_spec.rb file is inside controller spec only i.e. PROJECT_ROOT/spec/controllers/channels_controller_spec.rb. As per your suggestion i removed the setup method and moved user_attributes under example groups. but i am getting the same error which says RuntimeError in 'ChannelsController Brand Manager should not create channel' @controller is nil: make sure you set it in your test's setup method. Still confused why is this coming again. Following is the backtrace(Regarding a's its a minor prob.will do it) RuntimeError in 'ChannelsController Brand Manager should not create channel' @controller is nil: make sure you set it in your test's setup method. C:/Program Files/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_control ler/test_process.rb:378:in `process' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_control ler/test_process.rb:376:in `each' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_control ler/test_process.rb:376:in `process' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_control ler/test_process.rb:365:in `post' ./channels_controller_spec1.rb:149: C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/exampl e_methods.rb:40:in `instance_eval' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/exampl e_methods.rb:40:in `execute' C:/Program Files/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/exampl e_methods.rb:37:in `execute' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/exampl e_group_methods.rb:207:in `run_examples' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/exampl e_group_methods.rb:205:in `each' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/exampl e_group_methods.rb:205:in `run_examples' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/exampl e_group_methods.rb:103:in `run' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/runner/example _group_runner.rb:23:in `run' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/runner/example _group_runner.rb:22:in `each' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/runner/example _group_runner.rb:22:in `run' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/runner/options .rb:119:in `run_examples' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/runner/command _line.rb:9:in `run' C:/Program Files/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.6/bin/spec:4 C:/Program Files/ruby/bin/spec:19:in `load' C:/Program Files/ruby/bin/spec:19 > Where is this file? For rspec-rails to know that it's supposed to be a > controller spec, it either needs to be inside the > PROJECT_ROOT/spec/controllers directory, or you need to change the > describe declaration to this: > > describe ChannelsController, :type => :controller do > >> >> Contents of the file: >> >> require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') >> >> def setup >> �...@controller �= ChannelsController.new >> �...@request � � = ActionController::TestRequest.new >> �...@response � �= ActionController::TestResponse.new >> end > > Get rid of this setup. First of all, RSpec does this for you > automatically inside controller example groups. Secondly, this is > outside any example group (describe block), so it's not related to > anything anyway. > >> � �} >> end > > I'd move user_attributes inside the example group too. That way it's > scoped. If not, it's going to be available to (and possibly in > conflict with) any files that get loaded after this one. > >> end >> >> Now when i run this file i get error which says >> RuntimeError in 'ChannelsController Brand Manager should not create >> chnnel' >> @controller is nil: mke sure you set it in your test's setup method. > > Uh, where are all the 'a's in the backtrace? -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users