summaryrefslogtreecommitdiff
path: root/spec/rectangle_spec.rb
blob: cf718b87a5011b38c16aa495cf79c14131e76ca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
describe Scale::Rectangle do
  it { expect(subject.xml_tag).to eql(:rect) }

  describe "#attributes" do
    it "includes the x position of the top left corner" do
      subject.x = 10
      expect(subject.attributes).to include(x: 10)
    end

    it "includes the y position of the top left corner" do
      subject.y = 10
      expect(subject.attributes).to include(y: 10)
    end

    it "includes the width" do
      subject.width = "100%"
      expect(subject.attributes).to include(width: "100%")
    end

    it "includes the height" do
      subject.height = "100%"
      expect(subject.attributes).to include(height: "100%")
    end

    it "includes the x radius of the corners" do
      subject.rx = 10
      expect(subject.attributes).to include(rx: 10)
    end

    it "includes the y radius of the corners" do
      subject.ry = 10
      expect(subject.attributes).to include(ry: 10)
    end

    it "skips attributes that are not specified" do
      expect(subject.attributes).to be_empty
    end
  end
end