Sha256: 5676c4ae543eecbab0548b4a573516e4a3ee02190b4d2c9eaa87a37b210a4683

Contents?: true

Size: 999 Bytes

Versions: 1

Compression:

Stored size: 999 Bytes

Contents

shared_context "style context" do
  let(:fill_color) { Shoes::COLORS.fetch(:tomato) }
  let(:stroke_color) { Shoes::COLORS.fetch(:chartreuse) }

  before :each do
    subject.fill fill_color
    subject.stroke stroke_color
  end
end

shared_examples_for "persistent stroke" do
  include_context "style context"

  it "passes to element" do
    expect(element.stroke).to eq(stroke_color)
  end
end

shared_examples_for "persistent fill" do
  include_context "style context"

  it "passes to element" do
    expect(element.fill).to eq(fill_color)
  end
end

shared_examples_for "arc DSL method" do
  let(:arc) { dsl.arc(13, 44, 200, 300, 0, Shoes::TWO_PI) }

  it "creates a Shoes::Arc" do
    expect(arc).to be_an_instance_of(Shoes::Arc)
  end

  it "raises an ArgumentError" do
    lambda { dsl.arc(30) }.should raise_exception(ArgumentError)
  end

  it_behaves_like "persistent fill" do
    let(:element) { arc }
  end

  it_behaves_like "persistent stroke" do
    let(:element) { arc }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre1 spec/shoes/shared_examples/dsl/arc.rb