test/context_test.rb in riot-0.10.11 vs test/context_test.rb in riot-0.10.12.pre

- old
+ new

@@ -86,17 +86,16 @@ should("return the actual topic as the result of evaling the assertion") do (situation = Riot::Situation.new).topic = "bar" topic.equals("bar").run(situation) end.equals([:pass, %Q{is equal to "bar"}]) - asserts(:to_s).equals("asserts topic") + asserts(:to_s).equals("asserts that it") context "with an explicit description" do setup { Riot::Context.new("foo") {}.asserts_topic("get some") } asserts(:to_s).equals("asserts get some") end - end # The asserts_topic shortcut context "Using a hookup" do setup do situation = Riot::Situation.new @@ -106,5 +105,21 @@ situation.topic end asserts_topic.equals("I'm a string") end # Using a hookup + +context "Making a new context" do + asserts("RootContext is used if nil parent is provided") do + Riot::Context.new("hello", nil) {}.parent + end.kind_of(Riot::RootContext) +end # Making a context + +context "A context with a helper" do + setup { "foo" } + + helper(:upcase) { topic.upcase } + helper(:append) {|str| topic + str } + + asserts("executing the helper") { upcase }.equals("FOO") + asserts("calling a helper with an argument") { append("bar") }.equals("foobar") +end