Sha256: f15bbdb26e5dcbdf96635810d1a15b542cf3e0a240dd228b0851c4b4d11503b4

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

require 'teststrap'

context "Nesting a context" do
  setup do
    a_context = Riot::Context.new("foobar") do
      asserts("passing") { true }
      context "bazboo" do
        asserts("passing") { true }
        asserts("failing") { false }
        asserts("erroring") { raise Exception }
      end
    end
    a_context.run(MockReporter.new)
  end

  asserts("one passed test") { topic.passes == 2 }
  asserts("one failed test") { topic.failures == 1 }
  asserts("one errored test") { topic.errors == 1 }

  context "with setups" do
    setup do
      a_context = Riot::Context.new("foobar") do
        setup { "foo" }
        context "bazboo" do
          setup { topic + "bar" }
          asserts("passing") { topic == "foobar" }
        end
      end
      a_context.run(MockReporter.new)
    end

    asserts("parent setups are called") { topic.passes == 1 }
  end # with setups
end # Nesting a context

context "A context with nested descriptions as classes" do
  setup { Riot::Context.new(String) {}.context(Hash) {} }
  asserts(:description).equals { Hash }
  asserts(:detailed_description).equals("String Hash")
end # A context with nested descriptions as classes

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riot-0.12.7 test/core/context/nested_contexts_test.rb
riot-0.12.6 test/core/context/nested_contexts_test.rb
riot-0.12.5 test/core/context/nested_contexts_test.rb
riot-0.12.4 test/core/context/nested_contexts_test.rb
riot-0.12.3 test/core/context/nested_contexts_test.rb
riot-0.12.2 test/core/context/nested_contexts_test.rb
riot-0.12.1 test/core/context/nested_contexts_test.rb
riot-0.12.0 test/core/context/nested_contexts_test.rb
riot-0.12.0.pre test/core/context/nested_contexts_test.rb