From 6c35ffa99120bef16579ad68ed7b659be19a46dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Hu=CC=81ngaro?= Date: Mon, 30 May 2011 15:46:51 -0300 Subject: [PATCH 1/2] Changing method name to avoid conflict with rack-test --- lib/riot/context.rb | 4 ++-- lib/riot/context_options.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/riot/context.rb b/lib/riot/context.rb index 50954da..cc98c30 100644 --- a/lib/riot/context.rb +++ b/lib/riot/context.rb @@ -2,7 +2,7 @@ require 'riot/context_helpers' module Riot - RootContext = Struct.new(:setups, :teardowns, :detailed_description, :options) + RootContext = Struct.new(:setups, :teardowns, :detailed_description, :option_set) # Defines the classes {Riot::Context} will use when creating new assertions and situations. module ContextClassOverrides @@ -51,7 +51,7 @@ def initialize(description, parent=nil, &definition) @parent = parent || RootContext.new([],[], "", {}) @description = description @contexts, @setups, @assertions, @teardowns = [], [], [], [] - @options = @parent.options + @options = @parent.option_set prepare_middleware(&definition) end diff --git a/lib/riot/context_options.rb b/lib/riot/context_options.rb index 0e16ef9..2822ab1 100644 --- a/lib/riot/context_options.rb +++ b/lib/riot/context_options.rb @@ -11,7 +11,7 @@ module ContextOptions # @param [Object] key the key used to look up the option value later # @param [Object] value the option value to store def set(key, value) - options[key] = value + option_set[key] = value end # Returns the value of a set option. The key must match exactly, symbols and strings are not @@ -20,13 +20,13 @@ def set(key, value) # @param [Object] key the key used to look up the option value # @return [Object] def option(key) - options[key] + option_set[key] end # Returns the hash of defined options. # # @return [Hash] - def options + def option_set @options ||= {} end From ff41a669b7e6ffb1340cc982aa078d038016e15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Hu=CC=81ngaro?= Date: Tue, 31 May 2011 00:39:17 -0300 Subject: [PATCH 2/2] Fixing at_exit hook for use with Rake::TestTask --- lib/riot.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/riot.rb b/lib/riot.rb index 4fb8cbf..ad64170 100644 --- a/lib/riot.rb +++ b/lib/riot.rb @@ -28,7 +28,7 @@ def self.root_contexts # How to run Riot itself. This should be called +at_exit+ unless you suggested - by calling {Riot.alone!} # that you want to call this method yourself. If no {Riot.reporter} is set, the # {Riot::StoryReporter default} will be used. - # + # # You can change reporters by setting the manually via {Riot.reporter=} or by using one of: {Riot.dots}, # {Riot.silently!}, or {Riot.verbose}. # @@ -42,7 +42,7 @@ def self.run end # Options that configure how Riot will run. - # + # # @return [Hash] the options that tell Riot how to run def self.options @options ||= { @@ -125,8 +125,7 @@ def self.plain! # with the child status. at_exit do unless Riot.alone? - status = $?.exitstatus unless ($?.nil? || $?.success?) - exit(status || run.success?) + exit run.success? end end end # Riot