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

Some code refactorings #346

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 6 additions & 20 deletions lib/rspec/core/configuration_options.rb
Expand Up @@ -57,35 +57,21 @@ def drb_argv
end end


def parse_options def parse_options
@options = begin @options ||= [file_options, command_line_options, env_options].inject {|merged, o| merged.merge o}
options_to_merge = []
if custom_options_file
options_to_merge << custom_options
else
options_to_merge << global_options
options_to_merge << local_options
end
options_to_merge << command_line_options
options_to_merge << env_options

options_to_merge.inject do |merged, options|
merged.merge(options)
end
end
end end


private private


def file_options
custom_options_file ? custom_options : global_options.merge(local_options)
end

def env_options def env_options
ENV["SPEC_OPTS"] ? Parser.parse!(ENV["SPEC_OPTS"].split) : {} ENV["SPEC_OPTS"] ? Parser.parse!(ENV["SPEC_OPTS"].split) : {}
end end


def command_line_options def command_line_options
@command_line_options ||= begin @command_line_options ||= Parser.parse!(@args).merge :files_or_directories_to_run => @args
options = Parser.parse!(@args)
options[:files_or_directories_to_run] = @args
options
end
end end


def custom_options def custom_options
Expand Down