Sha256: 7a8a3fc03db57123fb61c5bb27f14719fd1c964fc124cc8825ef8e27e586706d

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'
require 'cucumber/step_mother'
require 'cucumber/ast'
require 'cucumber/core_ext/string'

module Cucumber
  module Ast
    describe Step do
      it "should replace arguments in name" do
        step = Step.new(1, 'Given', 'a <color> cucumber')

        invocation_table = Table.new([
          %w{color taste},
          %w{green juicy}
        ])
        cells = invocation_table.cells_rows[1]
        step_invocation = step.step_invocation_from_cells(cells)
        
        step_invocation.name.should == 'a green cucumber'
      end

      it "should replace arguments in table arg" do
        arg_table = Table.new([%w{taste_<taste> color_<color>}])

        step = Step.new(1, 'Given', 'a <color> cucumber', arg_table)

        invocation_table = Table.new([
          %w{color taste},
          %w{green juicy}
        ])
        cells = invocation_table.cells_rows[1]
        step_invocation = step.step_invocation_from_cells(cells)
        
        step_invocation.instance_variable_get('@multiline_arg').raw.should == [%w{taste_juicy color_green}]
      end

      it "should replace arguments in py string arg" do
        py_string = PyString.new(1, 2, 'taste_<taste> color_<color>', 0)

        step = Step.new(1, 'Given', 'a <color> cucumber', py_string)

        invocation_table = Table.new([
          %w{color taste},
          %w{green juicy}
        ])
        cells = invocation_table.cells_rows[1]
        step_invocation = step.step_invocation_from_cells(cells)
        
        step_invocation.instance_variable_get('@multiline_arg').to_s.should == 'taste_juicy color_green'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aslakhellesoy-cucumber-0.1.100.1 spec/cucumber/ast/step_spec.rb
aslakhellesoy-cucumber-0.1.100.2 spec/cucumber/ast/step_spec.rb
aslakhellesoy-cucumber-0.1.100.3 spec/cucumber/ast/step_spec.rb