Sha256: 56600b45e1ac2e43eb285f6244f9239c2f6b4d25a62551629784b034a9e0bd89

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

Feature: transactional examples

  Scenario: run in transactions (default)
    Given a file named "spec/models/widget_spec.rb" with:
      """
      require "spec_helper"

      describe Widget do
        it "has none to begin with" do
          Widget.count.should == 0
        end

        it "has one after adding one" do
          Widget.create
          Widget.count.should == 1
        end

        it "has none after one was created in a previous example" do
          Widget.count.should == 0
        end
      end
      """
    When I run "rspec spec/models/widget_spec.rb"
    Then I should see "3 examples, 0 failures"

  Scenario: run in transactions (explicit)
    Given a file named "spec/models/widget_spec.rb" with:
      """
      require "spec_helper"

      Rspec.configure do |c|
        c.use_transactional_examples = true
      end

      describe Widget do
        it "has none to begin with" do
          Widget.count.should == 0
        end

        it "has one after adding one" do
          Widget.create
          Widget.count.should == 1
        end

        it "has none after one was created in a previous example" do
          Widget.count.should == 0
        end
      end
      """
    When I run "rspec spec/models/widget_spec.rb"
    Then I should see "3 examples, 0 failures"

  Scenario: disable transactions (explicit)
    Given a file named "spec/models/widget_spec.rb" with:
      """
      require "spec_helper"

      Rspec.configure do |c|
        c.use_transactional_examples = false
      end

      describe Widget do
        it "has none to begin with" do
          Widget.count.should == 0
        end

        it "has one after adding one" do
          Widget.create
          Widget.count.should == 1
        end

        it "has one after one was created in a previous example" do
          Widget.count.should == 1
        end
      end
      """
    When I run "rspec spec/models/widget_spec.rb"
    Then I should see "3 examples, 0 failures"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.8 features/model_specs/transactional_examples.feature
rspec-rails-2.0.0.beta.7 features/model_specs/transactional_examples.feature
rspec-rails-2.0.0.beta.6 features/model_specs/transactional_examples.feature
rspec-rails-2.0.0.beta.5 features/model_specs/transactional_examples.feature