Class: RSpec::Core::ConfigurationOptions
- Defined in:
- lib/rspec/core/configuration_options.rb
Constant Summary collapse
- LOCAL_OPTIONS_FILE =
".rspec"
- GLOBAL_OPTIONS_FILE =
File.join(File.("~"), ".rspec")
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #configure(config) ⇒ Object
- #drb_argv ⇒ Object
-
#initialize(args) ⇒ ConfigurationOptions
constructor
A new instance of ConfigurationOptions.
- #parse_options ⇒ Object
Constructor Details
#initialize(args) ⇒ ConfigurationOptions
Returns a new instance of ConfigurationOptions.
13 14 15 |
# File 'lib/rspec/core/configuration_options.rb', line 13 def initialize(args) @args = args end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/rspec/core/configuration_options.rb', line 11 def @options end |
Instance Method Details
#configure(config) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/rspec/core/configuration_options.rb', line 17 def configure(config) keys = .keys keys.unshift(:requires) if keys.delete(:requires) keys.unshift(:libs) if keys.delete(:libs) keys.each do |key| config.send("#{key}=", [key]) end end |
#drb_argv ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rspec/core/configuration_options.rb', line 26 def drb_argv argv = [] argv << "--color" if [:color_enabled] argv << "--profile" if [:profile_examples] argv << "--backtrace" if [:full_backtrace] argv << "--tty" if [:tty] argv << "--fail-fast" if [:fail_fast] argv << "--format" << [:formatter] if [:formatter] argv << "--line_number" << [:line_number] if [:line_number] argv << "--example" << [:full_description].source if [:full_description] ([:libs] || []).each do |path| argv << "-I" << path end ([:requires] || []).each do |path| argv << "--require" << path end argv + [:files_or_directories_to_run] end |
#parse_options ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rspec/core/configuration_options.rb', line 45 def @options = begin = = () = = [, , , ].inject do |merged, | merged.merge() end end end |