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.4.5 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.4 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.3 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.2 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.4.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.3.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.3.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.2.8 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.2.7 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.2.6 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.2.5 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.2.3 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.2.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.2.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.1.17 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.1.16 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.1.15 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.1.14 spec/lib/test_support/cucumber/support/values_spec.rb