Sha256: 46041469fa3358a102548f5ecd7c5e41865ecfdd324388899288d001f3825bae

Contents?: true

Size: 1.27 KB

Versions: 31

Compression:

Stored size: 1.27 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_step_definition_arg.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_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

31 entries across 31 versions & 3 rubygems

Version Path
cucumber-0.8.7 spec/cucumber/ast/py_string_spec.rb
cucumber-0.10.3 spec/cucumber/ast/py_string_spec.rb
cucumber-0.10.2 spec/cucumber/ast/py_string_spec.rb
cucumber-0.10.1 spec/cucumber/ast/py_string_spec.rb
stefl-cucumber-0.10.1 spec/cucumber/ast/py_string_spec.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/ast/py_string_spec.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/ast/py_string_spec.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/ast/py_string_spec.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/cucumber-0.9.4/spec/cucumber/ast/py_string_spec.rb
cucumber-0.10.0 spec/cucumber/ast/py_string_spec.rb
cucumber-0.9.4 spec/cucumber/ast/py_string_spec.rb
cucumber-0.9.3 spec/cucumber/ast/py_string_spec.rb
cucumber-0.9.2 spec/cucumber/ast/py_string_spec.rb
cucumber-0.9.1 spec/cucumber/ast/py_string_spec.rb
cucumber-0.9.0 spec/cucumber/ast/py_string_spec.rb
cucumber-0.8.5 spec/cucumber/ast/py_string_spec.rb
cucumber-0.8.4 spec/cucumber/ast/py_string_spec.rb
cucumber-0.8.3 spec/cucumber/ast/py_string_spec.rb
cucumber-0.8.2 spec/cucumber/ast/py_string_spec.rb
cucumber-0.8.1 spec/cucumber/ast/py_string_spec.rb