On Mon, Dec 3, 2012 at 11:30 AM, Dean Richardson <[email protected]> wrote: > I'm still relatively new to RSpec. I'm trying to upgrade my Rails 2.3.11 > app to Rails 3, so I'm working to get a strong set of integration tests in > place. > > Right now, every occurrence of click_button in my integration specs is > leading to an error similar to the following when I run rake spec: > > NoMethodError in 'Projects create success should create a new project' > You have a nil object when you didn't expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.[] > C:/.../myapp/integration/projects_spec.rb:11 > > The first 12 lines of projects_spec.rb include: > > require 'spec_helper' > > describe "Projects" do > before(:each) do > @user = Factory(:user) > visit signin_path > fill_in "Email", :with => @user.email > fill_in "Password", :with => @user.password > click_button("Sign in") > end > > Line 11 is the "click_button" line. > > I'm using Rails 2.3.11 with rspec-rails 1.3.3, rspec 1.3.1, webrat 0.7.1, > and database_cleaner 0.5.0. > > As I've googled the various error messages, I've come across blog posts that > mention submit buttons being outside of forms or mismatched html tags. I've > checked my view template code and I don't seem to have those issues best I > can tell. > > I'd be grateful for any suggestions the group would have to get me past this > brick wall. > > Thanks!
My first suggestion would be to use the --backtrace flag so you get the full backtrace and you can see where that error is actually being raised. In rspec-1.x, you can do this by putting "--backtrace" in a spec.opts file in the project root. HTH, David -- You received this message because you are subscribed to the Google Groups "rspec" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
