-
-
Notifications
You must be signed in to change notification settings - Fork 762
Expose configuration options #834
Changes from all commits
08fef0d
1711cfd
330989f
4f6f367
53ba518
2ca7fac
47591a0
d9f704c
3b103f8
6da1f16
c80d755
8b25bbb
8405f76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,9 @@ def self.add_setting(name, opts={}) | |
# Indicates files configured to be required | ||
define_reader :requires | ||
|
||
# Returns dirs that have been prepended to the load path by #lib= | ||
define_reader :libs | ||
|
||
# Default: `$stdout`. | ||
# Also known as `output` and `out` | ||
add_setting :output_stream, :alias_with => [:output, :out] | ||
|
@@ -204,6 +207,7 @@ def initialize | |
@detail_color = :cyan | ||
@profile_examples = false | ||
@requires = [] | ||
@libs = [] | ||
end | ||
|
||
# @private | ||
|
@@ -462,6 +466,10 @@ def expect_with(*frameworks) | |
@expectation_frameworks.push(*modules) | ||
end | ||
|
||
def full_backtrace | ||
@backtrace_cleaner.full_backtrace | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here -- I think it would be more idiomatic as |
||
|
||
def full_backtrace=(true_or_false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please put blank lines between method defs -- I find that it helps readability a lot. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, sorry, I suck at that. |
||
@backtrace_cleaner.full_backtrace = true_or_false | ||
end | ||
|
@@ -492,7 +500,10 @@ def color=(bool) | |
define_predicate_for :color_enabled, :color | ||
|
||
def libs=(libs) | ||
libs.map {|lib| $LOAD_PATH.unshift lib} | ||
libs.map do |lib| | ||
@libs.unshift lib | ||
$LOAD_PATH.unshift lib | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little concerned that this isn't symmetric with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I could argue that I did this because the paths can be mutated from anywhere prior too... However I will defer and make this capture only the path's we've configured. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's another reason I think this should only return the load paths that have been added through rspec config: because if the user wants all load paths they can already get it via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heh the @github notification email couldn't cope with the outdated diff there, oh well, I've changed this in my most recent push anyhow. |
||
|
||
def requires=(paths) | ||
|
@@ -523,15 +534,27 @@ def debug=(bool) | |
end | ||
end | ||
|
||
def debug | ||
!!defined?(Debugger) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, I'm planning on removing the debug option in rspec 3...but it's fine to have this for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe here, too? ( |
||
|
||
# Run examples defined on `line_numbers` in all files to run. | ||
def line_numbers=(line_numbers) | ||
filter_run :line_numbers => line_numbers.map{|l| l.to_i} | ||
end | ||
|
||
def line_numbers | ||
filter.fetch(:line_numbers,[]) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, this isn't symmetric -- There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one makes the most sense to return directly, so done. |
||
|
||
def full_description=(description) | ||
filter_run :full_description => Regexp.union(*Array(description).map {|d| Regexp.new(d) }) | ||
end | ||
|
||
def full_description | ||
filter.fetch :full_description, false | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't symmetric either -- any reason not to have this return the assigned full description rather than just a boolean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thinking behind these non symmetrical readers was that they were filters, so they indicated wether the filters were on or not, (this thinking was caused by my reading of the specs, which are rather... oddly... structured when it comes to these 3 methods... ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think |
||
|
||
# @overload add_formatter(formatter) | ||
# | ||
# Adds a formatter to the formatters collection. `formatter` can be a | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is a boolean predicate, maybe it should be
full_backtrace?
.