Skip to content

Commit

Permalink
Use Node::Step instead of Builder::Step
Browse files Browse the repository at this point in the history
  • Loading branch information
gongo committed Oct 4, 2016
1 parent 510cd7e commit 63d8a86
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
14 changes: 13 additions & 1 deletion spec/support/example_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ def pending_example
example
end

def create_step_node(keyword, text, line)
step_metadata = {
type: :Step,
location: { line: line, column: 1 },
keyword: keyword,
text: text,
argument: nil
}

Turnip::Node::Step.new(step_metadata)
end

private

def base_example(&assertion)
Expand All @@ -37,7 +49,7 @@ def base_example(&assertion)
def example_metadata
{
turnip_formatter: {
steps: [Turnip::Builder::Step.new('Step 1', [], 1, 'When')],
steps: [create_step_node('Step', 'Step 1', 1)],
tags: []
}
}
Expand Down
2 changes: 1 addition & 1 deletion spec/support/step_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ def base_step(example)
end

def step_description
Turnip::Builder::Step.new('StepName', ['Docstring'], 1, 'Keyword')
create_step_node('Keyword', 'StepName', 1)
end
end
10 changes: 5 additions & 5 deletions spec/turnip_formatter/scenario/failure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
example = failed_example
example.metadata[:turnip_formatter] = {
steps: [
Turnip::Builder::Step.new('Step 1', [], 1, 'When'),
Turnip::Builder::Step.new('Step 2', [], 3, 'When'),
Turnip::Builder::Step.new('Step 3', [], 10, 'When'), # failed line
Turnip::Builder::Step.new('Step 4', [], 11, 'When'),
Turnip::Builder::Step.new('Step 5', [], 12, 'When')
create_step_node('When', 'Step 1', 1),
create_step_node('When', 'Step 2', 3),
create_step_node('When', 'Step 3', 10), # failed line
create_step_node('When', 'Step 4', 11),
create_step_node('When', 'Step 5', 12)
],
tags: []
}
Expand Down
10 changes: 5 additions & 5 deletions spec/turnip_formatter/scenario/pending_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
example = pending_example
example.metadata[:turnip_formatter] = {
steps: [
Turnip::Builder::Step.new('Step 1', [], 1, 'When'),
Turnip::Builder::Step.new('Step 2', [], 3, 'When'),
Turnip::Builder::Step.new('Step 3', [], 10, 'When'), # pending line
Turnip::Builder::Step.new('Step 4', [], 11, 'When'),
Turnip::Builder::Step.new('Step 5', [], 12, 'When')
create_step_node('When', 'Step 1', 1),
create_step_node('When', 'Step 2', 3),
create_step_node('When', 'Step 3', 10), # pending line
create_step_node('When', 'Step 4', 11),
create_step_node('When', 'Step 5', 12)
],
tags: []
}
Expand Down

0 comments on commit 63d8a86

Please sign in to comment.