Sha256: 51f0525c802a32c78ebf0853f70bfb72568845d5a091d5bc8dcdac581492db13

Contents?: true

Size: 1.17 KB

Versions: 28

Compression:

Stored size: 1.17 KB

Contents

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

module Cucumber
  module Ast
    describe PyString do
      it "should handle unindented" do
        ps = PyString.new(10, 13, "4.1\n4.2\n", 0)
        ps.to_s.should == "4.1\n4.2\n"
      end

      it "should handle indented" do
        #                    """
        ps = PyString.new(10, 13, "     4.1\n   4.2\n", 2)
        ps.to_s.should == "   4.1\n 4.2\n"
      end
      
      describe "replacing arguments" do

        before(:each) do
          @ps = PyString.new(10, 13, "<book>\n<qty>\n", 0)
        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

      end
      
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
aslakhellesoy-cucumber-0.1.100.1 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.100.2 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.100.3 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.16.5 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.1 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.10 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.11 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.12 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.13 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.14 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.15 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.17 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.18 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.19 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.2 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.20 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.21 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.22 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.23 spec/cucumber/ast/py_string_spec.rb
aslakhellesoy-cucumber-0.1.99.3 spec/cucumber/ast/py_string_spec.rb