Sha256: eb8103478115a9b60f98e4ed704f463980e2db226e077b090370a8a5b9d3f03f

Contents?: true

Size: 1.18 KB

Versions: 27

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'cucumber/ast/doc_string'

module Cucumber
  module Ast
    describe DocString do
      describe "replacing arguments" do

        before(:each) do
          @ps = DocString.new("<book>\n<qty>\n", '')
        end

        it "should return a new doc_string with arguments replaced with values" do
          doc_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere', '<qty>' => '5'})

          doc_string_with_replaced_arg.to_step_definition_arg.should == "Life is elsewhere\n5\n"
        end

        it "should not change the original doc_string" do
          doc_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere'})

          @ps.to_s.should_not include("Life is elsewhere")
        end

        it "should replaced nil with empty string" do
          ps = DocString.new("'<book>'", '')
          doc_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})

          doc_string_with_replaced_arg.to_step_definition_arg.should == "''"
        end

        it "should recognise when just a subset of a cell is delimited" do
          @ps.should have_text('<qty>')
        end

      end

    end
  end
end

Version data entries

27 entries across 25 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/cucumber-1.3.18/spec/cucumber/ast/doc_string_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/cucumber-1.3.18/spec/cucumber/ast/doc_string_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/cucumber-1.3.16/spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.20 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.19 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.18 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.17 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.16 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.15 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.14 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.13 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.12 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.11 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.10 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.9 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.8 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.7 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.6 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.5 spec/cucumber/ast/doc_string_spec.rb
cucumber-1.3.4 spec/cucumber/ast/doc_string_spec.rb