<commit_before>#Feature: DatabaseCleaner
#
#  Scenario: Create records in background
#    Given I have created a new Rails 3 app and installed cucumber-rails
#    And I write to "features/widgets.feature" with:
#      """
#      Feature: Create widgets
#        Background: some widdgets
#          Given I have 2 widgets
#      
#        Scenario: Add 3
#          When I create 3 more widgets
#          Then I should have 5 widgets
#
#        Scenario: Add 7
#          When I create 7 more widgets
#          Then I should have 9 widgets
#      """
#    And I successfully run `rails generate model widget name:string`
#    And I write to "features/step_definitions/widget_steps.rb" with:
#      """
#      Given /^I have (\d+) widgets$/ do |n|
#        n.to_i.times do |i|
#          Widget.create! :name => "Widget #{Widget.count + i}"
#        end
#      end
#
#      When /^I create (\d+) more widgets$/ do |n|
#        n.to_i.times do |i|
#          Widget.create! :name => "Widget #{Widget.count + i}"
#        end
#      end
#
#      Then /^I should have (\d+) widgets$/ do |n|
#        Widget.count.should == n.to_i
#      end
#      """
#    And I run `bundle exec rake db:migrate`
#    And I run `bundle exec rake cucumber`
#    Then it should pass with:
#       """
#       2 scenarios (2 passed)
#       6 steps (6 passed)
#       """<commit_msg>put back database_cleaner test and changed Rails 3 app reference to Rails app<commit_after>Feature: DatabaseCleaner

  Scenario: Create records in background
    Given I have created a new Rails app and installed cucumber-rails
    And I write to "features/widgets.feature" with:
      """
      Feature: Create widgets
        Background: some widdgets
          Given I have 2 widgets
      
        Scenario: Add 3
          When I create 3 more widgets
          Then I should have 5 widgets

        Scenario: Add 7
          When I create 7 more widgets
          Then I should have 9 widgets
      """
    And I successfully run `rails generate model widget name:string`
    And I write to "features/step_definitions/widget_steps.rb" with:
      """
      Given /^I have (\d+) widgets$/ do |n|
        n.to_i.times do |i|
          Widget.create! :name => "Widget #{Widget.count + i}"
        end
      end

      When /^I create (\d+) more widgets$/ do |n|
        n.to_i.times do |i|
          Widget.create! :name => "Widget #{Widget.count + i}"
        end
      end

      Then /^I should have (\d+) widgets$/ do |n|
        Widget.count.should == n.to_i
      end
      """
    And I run `bundle exec rake db:migrate`
    And I run `bundle exec rake cucumber`
    Then it should pass with:
       """
       2 scenarios (2 passed)
       6 steps (6 passed)
       """
{'fraction_non_alphanumeric': 0.10284463894967177, 'fraction_numerical': 0.0087527352297593, 'mean_word_length': 1.9494623655913978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7536805', 'n_tokens_mistral': 867, 'n_tokens_neox': 822, 'n_words': 319}