Sha256: 0e634dc6d9dda386372736077d2b0700253ac8c0770cb4f3651d77347f174fec

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

require 'shoes/spec_helper'

describe Shoes::Background do
  include_context "dsl app"

  let(:left) { 10 }
  let(:top) { 20 }
  let(:width) { 100 }
  let(:height) { 200 }

  let(:blue)  { Shoes::COLORS[:blue] }
  let(:input_opts){ {left: left, top: top, width: width, height: height, color: blue} }
  subject(:background) { Shoes::Background.new(app, parent, blue, input_opts) }

  it "retains app" do
    expect(background.app).to eq(app)
  end

  it "creates gui object" do
    expect(background.gui).not_to be_nil
  end

  it_behaves_like "object with style" do
    subject(:background) { Shoes::Background.new(app, parent, Shoes::COLORS[:black]) }
    let(:subject_without_style) { Shoes::Background.new(app, parent, blue) }
    let(:subject_with_style) { Shoes::Background.new(app, parent, blue, arg_styles) }
  end

  it_behaves_like "object with dimensions"

  describe "relative dimensions from parent" do
    subject { Shoes::Background.new(app, parent, blue, relative_opts) }
    it_behaves_like "object with relative dimensions"
  end

  context "negative dimensions" do
    subject { Shoes::Background.new(app, parent, blue, negative_opts) }
    it_behaves_like "object with negative dimensions"
  end

  describe '#needs_to_be_positioned?' do
    context 'without absolute dimensions' do
      let(:input_opts) {{}}
      it {is_expected.not_to be_needs_to_be_positioned}
    end

    context 'with absolute dimensions' do
      it {is_expected.to be_needs_to_be_positioned}
    end
  end

  it {is_expected.not_to be_takes_up_space}
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
shoes-swt-4.0.0.pre2 spec/shoes/background_spec.rb
shoes-dsl-4.0.0.pre2 spec/shoes/background_spec.rb