Wincent Colaiuta
2009-Jan-18 17:18 UTC
[rspec-users] Cucumber dying on decrement_open_transactions
I am trying to convert from Story Runner to Cucumber so have started with a really minimal story, but am dying with exceptions in ActiveRecord''s decrement_open_transactions method. I started took my shortest story and trimmed off steps until I got it down to the minimal case that aborts: Feature: accessing the wiki index As a user I want to view the wiki index So that I can get an overview of what is available Scenario: the wiki has no article Given no articles in the wiki When I access the wiki index Then I should see "Recently updated" The corresponding steps are: Given /^no articles in the wiki$/ do Article.destroy_all end When /^I access the wiki index$/ do get ''/wiki'' end But I die with: Feature: accessing the wiki index # features/wiki.feature As a user I want to view the wiki index So that I can get an overview of what is available Scenario: the wiki has no article # features/wiki.feature:6 Given no articles in the wiki # features/step_definitions/ wiki.rb:1 When I access the wiki index # features/step_definitions/ wiki.rb:9 Then I should see "Recently updated" # features/step_definitions/ webrat_steps.rb:83 /Users/wincent/demo/src/vendor/rails/activerecord/lib/active_record/ connection_adapters/abstract_adapter.rb:159:in `decrement_open_transactions'': You have a nil object when you didn''t expect it! (NoMethodError) You might have expected an instance of Array. The error occurred while evaluating nil.- from /Library/Ruby/Gems/1.8/ gems/cucumber-0.1.15/bin/../lib/cucumber/rails/world.rb:60:in `__cucumber_26364730'' I can make the error go away if I comment out: Cucumber::Rails.use_transactional_fixtures But I''d like to understand why it doesn''t work with the default setting, just in case I am doing something wrong. Cheers, Wincent
Mark Wilden
2009-Jan-18 18:37 UTC
[rspec-users] Cucumber dying on decrement_open_transactions
On Sun, Jan 18, 2009 at 9:18 AM, Wincent Colaiuta <win at wincent.com> wrote:> I am trying to convert from Story Runner to Cucumber so have started with a > really minimal story, but am dying with exceptions in ActiveRecord''s > decrement_open_transactions method. I started took my shortest story and > trimmed off steps until I got it down to the minimal case that aborts: >I filed a ticket on this yesterday: http://rspec.lighthouseapp.com/projects/16211/tickets/165-error-when-not-caching-classes Perhaps you could attach your test case to it? ///ark Feature: accessing the wiki index> As a user > I want to view the wiki index > So that I can get an overview of what is available > > Scenario: the wiki has no article > Given no articles in the wiki > When I access the wiki index > Then I should see "Recently updated" > > The corresponding steps are: > > Given /^no articles in the wiki$/ do > Article.destroy_all > end > > When /^I access the wiki index$/ do > get ''/wiki'' > end > > But I die with: > > Feature: accessing the wiki index # features/wiki.feature > As a user > I want to view the wiki index > So that I can get an overview of what is available > Scenario: the wiki has no article # features/wiki.feature:6 > Given no articles in the wiki # > features/step_definitions/wiki.rb:1 > When I access the wiki index # > features/step_definitions/wiki.rb:9 > Then I should see "Recently updated" # > features/step_definitions/webrat_steps.rb:83 > /Users/wincent/demo/src/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:159:in > `decrement_open_transactions'': You have a nil object when you didn''t expect > it! (NoMethodError) > You might have expected an instance of Array. > The error occurred while evaluating nil.- from > /Library/Ruby/Gems/1.8/gems/cucumber-0.1.15/bin/../lib/cucumber/rails/world.rb:60:in > `__cucumber_26364730'' > > I can make the error go away if I comment out: > > Cucumber::Rails.use_transactional_fixtures >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090118/f8041c3b/attachment.html>
Ben Mabey
2009-Jan-18 18:42 UTC
[rspec-users] Cucumber dying on decrement_open_transactions
On 1/18/09 10:18 AM, Wincent Colaiuta wrote:> I am trying to convert from Story Runner to Cucumber so have started > with a really minimal story, but am dying with exceptions in > ActiveRecord''s decrement_open_transactions method. I started took my > shortest story and trimmed off steps until I got it down to the > minimal case that aborts: > > Feature: accessing the wiki index > As a user > I want to view the wiki index > So that I can get an overview of what is available > > Scenario: the wiki has no article > Given no articles in the wiki > When I access the wiki index > Then I should see "Recently updated" > > The corresponding steps are: > > Given /^no articles in the wiki$/ do > Article.destroy_all > end > > When /^I access the wiki index$/ do > get ''/wiki'' > end > > But I die with: > > Feature: accessing the wiki index # features/wiki.feature > As a user > I want to view the wiki index > So that I can get an overview of what is available > Scenario: the wiki has no article # features/wiki.feature:6 > Given no articles in the wiki # > features/step_definitions/wiki.rb:1 > When I access the wiki index # > features/step_definitions/wiki.rb:9 > Then I should see "Recently updated" # > features/step_definitions/webrat_steps.rb:83 > /Users/wincent/demo/src/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:159:in > `decrement_open_transactions'': You have a nil object when you didn''t > expect it! (NoMethodError) > You might have expected an instance of Array. > The error occurred while evaluating nil.- from > /Library/Ruby/Gems/1.8/gems/cucumber-0.1.15/bin/../lib/cucumber/rails/world.rb:60:in > `__cucumber_26364730'' > > I can make the error go away if I comment out: > > Cucumber::Rails.use_transactional_fixtures > > But I''d like to understand why it doesn''t work with the default > setting, just in case I am doing something wrong.From what I can see I don''t believe you are doing anything wrong. What DB are you using? Perhaps your adapter doesn''t support transactions? (just a wild guess) -Ben
Ben Mabey
2009-Jan-18 18:48 UTC
[rspec-users] Cucumber dying on decrement_open_transactions
On 1/18/09 10:18 AM, Wincent Colaiuta wrote:> I am trying to convert from Story Runner to Cucumber so have started > with a really minimal story, but am dying with exceptions in > ActiveRecord''s decrement_open_transactions method. I started took my > shortest story and trimmed off steps until I got it down to the > minimal case that aborts: > > Feature: accessing the wiki index > As a user > I want to view the wiki index > So that I can get an overview of what is available > > Scenario: the wiki has no article > Given no articles in the wiki > When I access the wiki index > Then I should see "Recently updated" > > The corresponding steps are: > > Given /^no articles in the wiki$/ do > Article.destroy_all > end > > When /^I access the wiki index$/ do > get ''/wiki'' > end > > But I die with: > > Feature: accessing the wiki index # features/wiki.feature > As a user > I want to view the wiki index > So that I can get an overview of what is available > Scenario: the wiki has no article # features/wiki.feature:6 > Given no articles in the wiki # > features/step_definitions/wiki.rb:1 > When I access the wiki index # > features/step_definitions/wiki.rb:9 > Then I should see "Recently updated" # > features/step_definitions/webrat_steps.rb:83 > /Users/wincent/demo/src/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:159:in > `decrement_open_transactions'': You have a nil object when you didn''t > expect it! (NoMethodError) > You might have expected an instance of Array. > The error occurred while evaluating nil.- from > /Library/Ruby/Gems/1.8/gems/cucumber-0.1.15/bin/../lib/cucumber/rails/world.rb:60:in > `__cucumber_26364730'' > > I can make the error go away if I comment out: > > Cucumber::Rails.use_transactional_fixtures > > But I''d like to understand why it doesn''t work with the default > setting, just in case I am doing something wrong. > > Cheers, > Wincent > >Looking at the line in the adapter where it is failing I see: def decrement_open_transactions @open_transactions -= 1 end I can''t figure out how @open_transactions would ever be nil. I think your best chance to figure it out would be to step through the code with rubydebug starting in cucumber/rails/world.rb. (That is where the transactions are incremented and decremented.) -Ben