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.11.5 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.11.4 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.11.3 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.11.2 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.11.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.11.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.10.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.10.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.9.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.7 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.6 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.5 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.4 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.3 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.2 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.1 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.8.0 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.7.3 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.7.2 spec/lib/test_support/cucumber/support/values_spec.rb
sniff-0.7.1 spec/lib/test_support/cucumber/support/values_spec.rb