Sha256: 71c19055e9cfca9b885cd9529044b58aabb7f86f222a816a51d46fc48f19d523

Contents?: true

Size: 791 Bytes

Versions: 18

Compression:

Stored size: 791 Bytes

Contents

require 'spec_helper'

describe WorkingHours::DurationProxy do
  describe '#initialize' do
    it 'is constructed with a value' do
      proxy = WorkingHours::DurationProxy.new(42)
      expect(proxy.value).to eq(42)
    end
  end

  context 'proxy methods' do

    let(:proxy) { WorkingHours::DurationProxy.new(42) }

    WorkingHours::Duration::SUPPORTED_KINDS.each do |kind|
      singular = kind[0..-2]

      it "##{kind} returns a duration object" do
        duration = proxy.send(kind)
        expect(duration.value).to eq(42)
        expect(duration.kind).to eq(kind)
      end

      it "##{singular} returns a duration object" do
        duration = proxy.send(singular)
        expect(duration.value).to eq(42)
        expect(duration.kind).to eq(kind)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
working_hours-1.5.0 spec/working_hours/duration_proxy_spec.rb
working_hours-1.4.1 spec/working_hours/duration_proxy_spec.rb
working_hours-1.4.0 spec/working_hours/duration_proxy_spec.rb
working_hours-1.3.2 spec/working_hours/duration_proxy_spec.rb
working_hours-1.3.1 spec/working_hours/duration_proxy_spec.rb
working_hours-1.3.0 spec/working_hours/duration_proxy_spec.rb
working_hours-1.2.0 spec/working_hours/duration_proxy_spec.rb
working_hours-1.1.4 spec/working_hours/duration_proxy_spec.rb
working_hours-1.1.3 spec/working_hours/duration_proxy_spec.rb
working_hours-1.1.2 spec/working_hours/duration_proxy_spec.rb
working_hours-1.1.1 spec/working_hours/duration_proxy_spec.rb
working_hours-1.1.0 spec/working_hours/duration_proxy_spec.rb
working_hours-1.0.4 spec/working_hours/duration_proxy_spec.rb
working_hours-1.0.3 spec/working_hours/duration_proxy_spec.rb
working_hours-1.0.2 spec/working_hours/duration_proxy_spec.rb
working_hours-1.0.1 spec/working_hours/duration_proxy_spec.rb
working_hours-1.0.0 spec/working_hours/duration_proxy_spec.rb
working_hours-0.9.0 spec/working_hours/duration_proxy_spec.rb