Sha256: aa4644976552108ec5b5b34f31be055913073ac6ff2702eed88ab2574b9727a2

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'shoes/color'

shared_examples_for "object with stroke" do
  let(:color) { Shoes::COLORS.fetch :tomato }

  specify "returns a color" do
    c = subject.stroke = color
    c.class.should eq(Shoes::Color)
  end

  specify "sets on receiver" do
    subject.stroke = color
    subject.stroke.should eq(color)
    subject.style[:stroke].should eq(color)
  end

  # Be sure the subject does *not* have the stroke set previously
  specify "defaults to black" do
    subject.stroke.should eq(Shoes::COLORS.fetch :black)
  end

  describe "strokewidth" do
    specify "defaults to 1" do
      subject.strokewidth.should eq(1)
    end

    specify "sets" do
      subject.strokewidth = 2
      subject.strokewidth.should eq(2)
    end
  end
end

shared_examples_for "object with fill" do
  let(:color) { Shoes::COLORS.fetch :honeydew }

  specify "returns a color" do
    c = subject.fill = color
    c.class.should eq(Shoes::Color)
  end

  specify "sets on receiver" do
    subject.fill = color
    subject.fill.should eq(color)
    subject.style[:fill].should eq(color)
  end

  # Be sure the subject does *not* have the stroke set previously
  specify "defaults to black" do
    subject.fill.should eq(Shoes::COLORS.fetch :black)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre1 spec/shoes/shared_examples/shared_element_method.rb