Sha256: e6fbd6d05c0a0e3bfb8f8da1393c037ac938996ba89084efc20107277653f4a0

Contents?: true

Size: 751 Bytes

Versions: 5

Compression:

Stored size: 751 Bytes

Contents

shared_examples_for "background DSL method" do
  context "with a valid hex string" do
    it "sets color" do
      background = subject.background("#fff")
      expect(background.fill).to eq(Shoes::COLORS[:white])
    end
  end

  context "with an invalid hex string" do
    it 'raises an argument error' do
      expect{ subject.background('#ffq') }.to raise_error('Bad hex color: #ffq')
    end
  end

  context 'with no valid image' do
    it 'ignores the background' do
      expect{ subject.background('fake-shoes.jpg') }.not_to raise_error
    end
  end

  context 'with a valid image' do
    it 'creates a Shoes::Background' do
      expect(subject.background('static/shoes-icon.png')).to be_an_instance_of(Shoes::Background)
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
shoes-core-4.0.0.pre4 spec/shoes/shared_examples/dsl/background.rb
shoes-core-4.0.0.pre3 spec/shoes/shared_examples/dsl/background.rb
shoes-swt-4.0.0.pre2 spec/shoes/shared_examples/dsl/background.rb
shoes-dsl-4.0.0.pre2 spec/shoes/shared_examples/dsl/background.rb
shoes-4.0.0.pre1 spec/shoes/shared_examples/dsl/background.rb