Sha256: 3879a830309a06daaf4720983ff692a5a676653e4edc44ca5cf763fd760e2ca7
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe CompassPoint do describe '.azimuth' do it 'returns mid point in degrees' do expect(CompassPoint.azimuth('N')).to eq 0.0 expect(CompassPoint.azimuth(:nw)).to eq 315.0 expect(CompassPoint.azimuth('sbw')).to eq 191.25 expect(CompassPoint.azimuth('X')).to be_nil end end describe '.min' do it 'returns min point in degrees' do expect(CompassPoint.min('N')).to eq 354.38 expect(CompassPoint.min(:nw)).to eq 309.38 expect(CompassPoint.min('sbw')).to eq 185.63 expect(CompassPoint.min('X')).to be_nil end end describe '.max' do it 'returns max point in degrees' do expect(CompassPoint.max('N')).to eq 5.62 expect(CompassPoint.max(:nw)).to eq 320.62 expect(CompassPoint.max('sbw')).to eq 196.87 expect(CompassPoint.max('X')).to be_nil end end describe '.min_max' do it 'returns [min, max]' do expect(CompassPoint.min_max('N')).to eq [354.38, 5.62] expect(CompassPoint.min_max(:nw)).to eq [309.38, 320.62] expect(CompassPoint.min_max('sbw')).to eq [185.63, 196.87] expect(CompassPoint.min_max('X')).to be_nil end end describe '.name' do it 'returns the points full name' do expect(CompassPoint.name('nnw')).to eq 'North northwest' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
compass_point-1.0.3 | spec/compass_point_spec.rb |
compass_point-1.0.2 | spec/compass_point_spec.rb |