Sha256: 5ed5c3faeaf881c38d5d410cedb7f2647e224586722670326c9394997358b87b

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'cucumber/ast/py_string'

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

        before(:each) do
          @ps = PyString.new("<book>\n<qty>\n")
        end
      
        it "should return a new py_string with arguments replaced with values" do
          py_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere', '<qty>' => '5'})
                
          py_string_with_replaced_arg.to_s.should == "Life is elsewhere\n5\n"
        end
        
        it "should not change the original py_string" do
          py_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 = PyString.new("'<book>'")
          py_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil}) 
          
          py_string_with_replaced_arg.to_s.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

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-0.7.0.beta.2 spec/cucumber/ast/py_string_spec.rb
cucumber-0.7.0.beta.1 spec/cucumber/ast/py_string_spec.rb