Sha256: 19c1c10bb7b178b8f6b85057f7c983e2c59ae15e0fb7cd2db23dd63d02b200aa

Contents?: true

Size: 827 Bytes

Versions: 8

Compression:

Stored size: 827 Bytes

Contents

require_relative '../../spec_helper'
require 'virtus'

module Barometer
  class TestClass
    include Virtus.model
    attribute :timezone, Data::Attribute::Zone
  end

  describe Data::Attribute::Zone do
    let(:model) { TestClass.new }

    context 'when nothing has been set' do
      it 'returns nil' do
        expect( model.timezone ).to be_nil
      end
    end

    context 'when setting to nil' do
      it 'resets the value' do
        model.timezone = Barometer::Data::Zone.new('MST')
        model.timezone = nil
        expect( model.timezone ).to be_nil
      end
    end

    context 'when setting with data to be interpretted as a time zone' do
      it 'sets the value' do
        model.timezone = Barometer::Data::Zone.new('PDT')
        expect( model.timezone.code ).to eq 'PDT'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 spec/data/attributes/zone_spec.rb
barometer-0.9.6 spec/data/attributes/zone_spec.rb
barometer-0.9.5 spec/data/attributes/zone_spec.rb
barometer-0.9.4 spec/data/attributes/zone_spec.rb
barometer-0.9.3 spec/data/attributes/zone_spec.rb
barometer-0.9.2 spec/data/attributes/zone_spec.rb
barometer-0.9.1 spec/data/attributes/zone_spec.rb
barometer-0.9.0 spec/data/attributes/zone_spec.rb