Skip to content

Commit

Permalink
Merge pull request #418 from cucumber/pretty_formatter_spec
Browse files Browse the repository at this point in the history
Pretty formatter spec
  • Loading branch information
os97673 committed Apr 4, 2013
2 parents e0ce988 + 74cf98a commit 24496a2
Show file tree
Hide file tree
Showing 4 changed files with 399 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/cucumber/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,15 @@ def self.parse(args, out_stream, error_stream, options = {})
new(out_stream, error_stream, options).parse!(args)
end

attr_reader :profiles, :skip_profile_information

def initialize(out_stream = STDOUT, error_stream = STDERR, options = {})
@out_stream = out_stream
@error_stream = error_stream

@default_profile = options[:default_profile]
@skip_profile_information = options[:skip_profile_information]
@profiles = []
@overridden_paths = []
@options = default_options
@options[:skip_profile_information] = options[:skip_profile_information]

@quiet = @disable_profile_loading = nil
end
Expand Down Expand Up @@ -317,8 +315,8 @@ def filters

protected

attr_reader :options, :expanded_args
protected :options, :expanded_args
attr_reader :options, :profiles, :expanded_args
protected :options, :profiles, :expanded_args

private

Expand Down Expand Up @@ -357,6 +355,8 @@ def merge_profiles
Options.parse(profile_args, @out_stream, @error_stream, :skip_profile_information => true)
)
end

@options[:profiles] = @profiles
end

def default_profile_should_be_used?
Expand Down
4 changes: 2 additions & 2 deletions lib/cucumber/formatter/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def empty_messages
end

def print_profile_information
return if @options.skip_profile_information || @options.profiles.empty?
profiles = @options.profiles
return if @options[:skip_profile_information] || @options[:profiles].nil? || @options[:profiles].empty?
profiles = @options[:profiles]
profiles_sentence = ''
profiles_sentence = profiles.size == 1 ? profiles.first :
"#{profiles[0...-1].join(', ')} and #{profiles.last}"
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/formatter/pretty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def step_name(keyword, step_match, status, source_indent, background, file_colon
end

def doc_string(string)
return if @hide_this_step
return if @options[:no_multiline] || @hide_this_step
s = %{"""\n#{string}\n"""}.indent(@indent)
s = s.split("\n").map{|l| l =~ /^\s+$/ ? '' : l}.join("\n")
@io.puts(format_string(s, @current_step.status))
Expand Down
Loading

0 comments on commit 24496a2

Please sign in to comment.