Sha256: 4fa7d01d17b8ac3b358cb7d338c624f4f7cbbe8932a199cf4fbf78b1f3bf6b63

Contents?: true

Size: 836 Bytes

Versions: 8

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_examples 'a cuboid' do
  let(:args) do
    {
      dimensions: [
        Measured::Length.new(1.1, :cm),
        Measured::Length.new(3.3, :cm),
        Measured::Length.new(2.2, :cm)
      ]
    }
  end

  it { is_expected.to be_a(Physical::Cuboid) }

  it "has dimensions as Measured::Length objects with rational values" do
    expect(subject.dimensions).to eq(
      [
        Measured::Length.new(1.1, :cm),
        Measured::Length.new(3.3, :cm),
        Measured::Length.new(2.2, :cm)
      ]
    )
  end

  it "has getter methods for each dimension as Measured::Length object" do
    expect(subject.length).to eq(Measured::Length.new(1.1, :cm))
    expect(subject.width).to eq(Measured::Length.new(3.3, :cm))
    expect(subject.height).to eq(Measured::Length.new(2.2, :cm))
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
physical-0.4.3 lib/physical/spec_support/shared_examples.rb
physical-0.4.2 lib/physical/spec_support/shared_examples.rb
physical-0.4.1 lib/physical/spec_support/shared_examples.rb
physical-0.4.0 lib/physical/spec_support/shared_examples.rb
physical-0.3.3 lib/physical/spec_support/shared_examples.rb
physical-0.3.2 lib/physical/spec_support/shared_examples.rb
physical-0.3.1 lib/physical/spec_support/shared_examples.rb
physical-0.3.0 lib/physical/spec_support/shared_examples.rb