Sha256: aaf42f0c10bf0a681403e53b7f8e7f50e74f9ab95cf697cb9490446b83c189cb

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'
require 'sugar-high/numeric'

class Numeric
  include NumberDslExt  
end    

module Num
  extend NumericCheckExt
end

describe "SugarHigh" do
  describe 'NumericCheckExt' do
    describe '#numeric?' do
      it 'string "x1" is not numeric' do
        Num.numeric?("x0").should be_false
      end

      it '123 is numeric' do
        Num.numeric?(123).should be_true
      end

      it '12.3 is numeric' do
        Num.numeric?(12.3).should be_true
      end
    end
    
    describe 'check_numeric!' do
      it 'string "x1" is not numeric' do
        lambda {Num.check_numeric!("x0")}.should raise_error
      end

      it '123 is numeric' do
        lambda {Num.check_numeric!(123)}.should_not raise_error
      end
    end
  end
  
  describe 'NumberDslExt' do
    describe '#hundred' do
      it '2 hundred is 200' do
        2.hundred.should == 200
      end
    end
    describe '#thousand' do
      it '3 thousand is 3000' do
        3.thousand.should == 3000
      end
    end
  end
end
      

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sugar-high-0.6.3 spec/sugar-high/numeric_spec.rb
sugar-high-0.6.2.1 spec/sugar-high/numeric_spec.rb
sugar-high-0.6.1 spec/sugar-high/numeric_spec.rb
sugar-high-0.6.0 spec/sugar-high/numeric_spec.rb
sugar-high-0.5.5 spec/sugar-high/numeric_spec.rb
sugar-high-0.5.4 spec/sugar-high/numeric_spec.rb
sugar-high-0.5.3 spec/sugar-high/numeric_spec.rb
sugar-high-0.5.1 spec/sugar-high/numeric_spec.rb
sugar-high-0.5.0 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.9.5 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.9.3 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.9.2 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.9.1 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.9 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.8 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.7 spec/sugar-high/numeric_spec.rb
sugar-high-0.4.6.4 spec/sugar-high/numeric_spec.rb