Sha256: fe50987e810cdfdb30fca909d22d93a92948d07c8a23617304b12a6b61ac80d1

Contents?: true

Size: 1.14 KB

Versions: 59

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'test_support/cucumber/support/values'

include CucumberValueParser

describe CucumberValueParser do
  describe '#coerce_value' do
    it 'should leave a nil value alone' do
      coerce_value(nil).should be_nil
    end
    it 'should parse "false" into a boolean' do
      coerce_value('false').should be_false
    end
    it 'should parse "true" into a boolean' do
      coerce_value('true').should be_true
    end
    it 'should parse a float' do
      coerce_value('2.3').should == 2.3
    end
    it 'should parse a zero-prefixed float' do
      coerce_value('2.0').should == 2.0
    end
    it 'should parse an integer' do
      coerce_value('2').should == 2
    end
    it 'should parse a date' do
      coerce_value('today').should be_an_instance_of(Time)
      coerce_value('2010-01-20').should be_an_instance_of(Time)
      coerce_value('2010-01-20 13:00:00').should be_an_instance_of(Time)
      coerce_value('2 days from now').should be_an_instance_of(Time)
    end
    it 'should leave regular strings alone' do
      coerce_value('sandwich').should == 'sandwich'
      coerce_value('UA').should == 'UA'
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
sniff-0.7.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.8 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.7 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.6 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.5 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.4 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.3 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.2 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.6.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.5.3 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.5.2 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.5.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.5.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.12 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.11 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.10 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.9 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.7 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.6 spec/lib/test_support/cucumber/support/values_spec.rb