Sha256: f850d7e289ac3cc3739f9a6e5be0fac1b90508090909165dad9db2b898a1a11e

Contents?: true

Size: 1.62 KB

Versions: 10

Compression:

Stored size: 1.62 KB

Contents

== Fixture Backgrounds

Generate fixtures from factories _in_ you testcode to speedup test-runs!

Requires shoulda 2.11.3 (exact version for now - sorry)

thies@tmp8.de 20110207

== Usage

see test/rails3 for a demo usage

in test_helper.rb:

  require 'fixture_background'

  class ActiveSupport::TestCase
    include ::FixtureBackground::ActiveSupport::TestCase
  end

in some_test.rb:

  require 'test_helper'

  class TestTest < ActiveSupport::TestCase
    background do
      @hase = Hase.create(:name => "bunny")
    end

    context "with thies" do
      background do
        @thies = Person.create(:name => "thies")
      end
    
      should "be cool" do
        assert @hase
        assert @thies
        assert_nil @manuel
        assert_nil @norman
        assert_equal 1, Person.count
      end

      context "with manuel" do
        background do
          @manuel = Person.create(:name => "manuel")
        end
    
        should "be cool" do
          assert @hase
          assert @thies
          assert @manuel
          assert_nil @norman
          assert_equal 2, Person.count
        end
      
        context "with norman" do
          background do
            @norman = Person.create(:name => "norman")
          end
      
          should "be cool" do
            assert @hase
            assert @thies
            assert @manuel
            assert @norman
            assert_equal 3, Person.count
          end
        end
      end

      should "nother truth" do
        assert @hase
        assert @thies
        assert_nil @manuel
        assert_nil @norman
        assert_equal 1, Person.count
      end
    end
  end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fixture_background-0.9.10.1 README.rdoc
fixture_background-0.9.10 README.rdoc
fixture_background-0.9.9 README.rdoc
fixture_background-0.9.8 README.rdoc
fixture_background-0.9.7 README.rdoc
fixture_background-0.9.6 README.rdoc
fixture_background-0.9.5 README.rdoc
fixture_background-0.9.4 README.rdoc
fixture_background-0.9.3 README.rdoc
fixture_background-0.9.2 README.rdoc