Sha256: 4c38b7de98f51f7b4af6387ab42bc1c649559925a57c8dea0ecc0f8ec471a4a1

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 KB

Contents

require File.dirname(__FILE__) + "/../lib/contest"

class FooTest < Test::Unit::TestCase
  setup do
    @value = 1
  end

  teardown do
    @value = nil
  end

  test "truth" do
    assert_equal 1, @value
  end

  context "context's non-word characters " do
    should "run the test inside" do
      assert_equal 1, @value
    end
  end

  context "some context" do
    setup do
      @value += 1
    end

    test "another truth" do
      assert_equal 2, @value
    end

    context "and a nested context" do
      setup do
        @value += 1
      end

      test "more" do
        assert_equal 3, @value
      end
    end
  end

  context "some other context" do
    setup do
      @value += 1
    end

    test "yet another truth" do
      assert_equal 2, @value
    end
  end

  describe "context with should" do
    setup do
      @value += 1
    end

    should "yet another truth" do
      assert_equal 2, @value
    end
  end
end

class BarTest < Test::Unit::TestCase
  setup do
    @value = 1
  end

  context "some context" do
    setup do
      @value += 1
    end

    test "another truth" do
      assert_equal 2, @value
    end

    test "another truth" do
      assert_equal 2, @value
    end
  end
end

class TestBaz < Test::Unit::TestCase
  def foo
    42
  end

  def setup
    @value = 1
    super
  end

  context "some context" do
    def setup
      super
      @value += 2
    end
      
    test "a helper" do
      assert_equal 42, foo
      assert_equal 3, @value
    end
    
    context "another context" do
      setup do
        @value += 3
      end

      test "blah" do
        assert_equal 6, @value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
citrusbyte-contest-0.1.0 test/all_test.rb
citrusbyte-contest-0.1.1 test/all_test.rb
contest-0.1.1 test/all_test.rb