Sha256: 06250794c7240da24386146f6130a78cf9a9c762624a51d71b601b6b6ecb32be

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe "Forecasted Night Measurement" do
  
  describe "when initialized" do
    
    before(:each) do
      @night = Measurement::ForecastNight.new
    end
    
    it "responds to date" do
      @night.date.should be_nil
    end
    
    it "responds to pop" do
      @night.pop.should be_nil
    end

  end
  
  describe "when writing data" do
    
    before(:each) do
      @night = Measurement::ForecastNight.new
    end
    
    it "only accepts Date for date" do
      invalid_data = 1
      invalid_data.class.should_not == Date
      lambda { @night.date = invalid_data }.should raise_error(ArgumentError)
      
      valid_data = Date.new
      valid_data.class.should == Date
      lambda { @night.date = valid_data }.should_not raise_error(ArgumentError)
    end
    
    it "only accepts Fixnum for pop" do
      invalid_data = "test"
      invalid_data.class.should_not == Fixnum
      lambda { @night.pop = invalid_data }.should raise_error(ArgumentError)
      
      valid_data = 50
      valid_data.class.should == Fixnum
      lambda { @night.pop = valid_data }.should_not raise_error(ArgumentError)
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
attack-barometer-0.6.0 spec/measurements/night_measurement_spec.rb
attack-barometer-0.6.1 spec/measurements/night_measurement_spec.rb
barometer-0.6.1 spec/measurements/night_measurement_spec.rb