Skip to content

Commit

Permalink
Tweaks to the output
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Aug 11, 2008
1 parent 6c3fe5d commit 34efdb7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/cucumber/formatters/pretty_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ def print_snippets
prev_keyword = nil
snippets = @pending.map do |step|
next if step.row?
keyword = step.keyword == Cucumber.language['and'] ? prev_keyword : step.keyword
snippet = "#{keyword} /#{step.name}/ do\nend\n\n"
snippet = "#{step.actual_keyword} /#{step.name}/ do\nend\n\n"
prev_keyword = step.keyword
snippet
end.compact.uniq
Expand Down
1 change: 1 addition & 0 deletions lib/cucumber/rails/world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def initialize #:nodoc:
Before do
ActiveRecord::Base.send :increment_open_transactions
ActiveRecord::Base.connection.begin_db_transaction
ActionMailer::Base.deliveries = [] if defined?(ActionMailer::Base)
end

After do
Expand Down
6 changes: 6 additions & 0 deletions lib/cucumber/tree/scenario.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ def accept(visitor)
def at_line?(l)
line == l || steps.map{|s| s.line}.index(l)
end

def previous_step(step)
i = steps.index(step)
raise "Couldn't find #{step} among #{steps}" if i.nil?
steps[i-1]
end
end

class Scenario < BaseScenario
Expand Down
8 changes: 8 additions & 0 deletions lib/cucumber/tree/step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ def format_error(strip_pos, e)
def id
@id ||= self.class.new_id!
end

def actual_keyword
keyword == Cucumber.language['and'] ? previous_step.actual_keyword : keyword
end

def previous_step
@scenario.previous_step(self)
end
end

class Step < BaseStep
Expand Down

0 comments on commit 34efdb7

Please sign in to comment.