Sha256: da618f5c987a3148f490578b359df4ebc2cc69662cc49450524aba67189f3440

Contents?: true

Size: 917 Bytes

Versions: 6

Compression:

Stored size: 917 Bytes

Contents

require 'spec_helper'

describe Spyglass::Point do
  let(:point) { Spyglass::Point.new(10, 20) }

  describe '.new' do
    it 'should require two arguments' do
      expect { Spyglass::Point.new }.to raise_error ArgumentError
      expect( point ).to be_a Spyglass::Point
    end
  end
  
  describe 'accessors' do
    describe '#x' do
      it 'should return the correct X coordinate' do
        expect( point.x ).to eq(10)
      end
    end

    describe '#y' do
      it 'should return the correct Y coordinate' do
        expect( point.y ).to eq(20)
      end
    end
  end

  describe 'setters' do
    describe '#x=' do
      it 'should set the value of the X coordinate' do
        point.x = 20
        expect( point.x ).to eq(20)
      end
    end
    describe '#y=' do
      it 'should set the value of the Y coordinate' do
        point.y = 40
        expect( point.y ).to eq(40)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spyglass-0.0.5.1 spec/spyglass/point_spec.rb
spyglass-0.0.5 spec/spyglass/point_spec.rb
spyglass-0.0.4.1 spec/spyglass/point_spec.rb
spyglass-0.0.4 spec/spyglass/point_spec.rb
spyglass-0.0.3 spec/spyglass/point_spec.rb
spyglass-0.0.2 spec/spyglass/point_spec.rb