Sha256: cf5b1642841b0fcdce24e3e539ec8c4b96636b96d8514f79d291c53724dd6cf8

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

shared_examples_for "rgb DSL method" do
  let(:red) { 100 }
  let(:green) { 149 }
  let(:blue) { 237 }
  let(:alpha) { 133 } # cornflowerblue

  it "sends args to Shoes::Color" do
    allow(Shoes::Color).to receive(:new)
    dsl.rgb(red, green, blue, alpha)
    expect(Shoes::Color).to have_received(:new).with(red, green, blue, alpha)
  end

  it "defaults to opaque" do
    allow(Shoes::Color).to receive(:new)
    dsl.rgb(red, green, blue)
    expect(Shoes::Color).to have_received(:new).with(red, green, blue, Shoes::Color::OPAQUE)
  end

  describe "named color method" do
    it "produces correct color" do
      expect(dsl.cornflowerblue).to eq(Shoes::Color.new(red, green, blue))
    end

    it "accepts alpha arg" do
      expect(dsl.cornflowerblue(alpha)).to eq(Shoes::Color.new(red, green, blue, alpha))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-core-4.0.0.pre7 spec/shoes/shared_examples/dsl/rgb.rb