Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conflict with rack-test and at_exit hook issues #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/riot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
#
Expand All @@ -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 ||= {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/riot/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions lib/riot/context_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down