summaryrefslogtreecommitdiffhomepage
path: root/test/line_spec.rb
blob: 04445d1aabc274679fa353ba8a57a7aca927ab16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'ruby2d'

RSpec.describe Ruby2D::Triangle do
  describe '#contains?' do
    it "returns true if point is inside line" do
      line = Line.new(
        0, 0,
        100, 100
      )
      expect(line.contains?(25, 25)).to be true
    end

    it "returns true if point is inside text" do
      line = Line.new(
        0, 0,
        100, 100
      )

      expect(line.contains?(0, 10)).to be false
      expect(line.contains?(10, 0)).to be false
    end
  end
end