Sha256: c5f7b5738ff7dec0f82f4aebb0662c6ad94c24752c92abc7417c2d4e6e3f6979

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require 'test_helper'

class PersonTest < ActiveSupport::TestCase
  
  background do
    some_test_helper_returning_one
    instance_test_helper_defined_after_background_returning_one
    @hase = Person.create(:name => "bunny")
  end

  context "with thies" do
    background do
      some_test_helper_returning_one
      instance_test_helper_defined_after_background_returning_one
      @thies = Person.create(:name => "thies")
    end
    
    should "be cool" do
      assert @hase
      assert @thies
      assert_nil @manuel
      assert_nil @norman
      assert_equal 2, 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 3, 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 4, Person.count
        end
      end
    end
  
    should "nother truth" do
      assert @hase
      assert @thies
      assert_nil @manuel
      assert_nil @norman
      assert_equal 2, Person.count
    end
  end

  def instance_test_helper_defined_after_background_returning_one
    1
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fixture_background-0.9.6 test/rails3/test/unit/person_test.rb