spec/shoes/swt/button_spec.rb in shoes-swt-4.0.0.pre4 vs spec/shoes/swt/button_spec.rb in shoes-swt-4.0.0.pre5

- old
+ new

@@ -1,20 +1,18 @@ -require 'shoes/swt/spec_helper' +require 'spec_helper' describe Shoes::Swt::Button do include_context "swt app" let(:text) { "TEXT" } let(:dsl) { double('dsl', app: shoes_app, text: text, blk: block, element_width: 100, element_height: 200).as_null_object } let(:block) { proc {} } let(:real) { double('real', disposed?: false).as_null_object } - subject { Shoes::Swt::Button.new dsl, parent } + subject { Shoes::Swt::Button.new dsl, swt_app } before :each do - allow(parent).to receive(:real) - allow(parent).to receive(:dsl){double(contents: [])} allow(dsl).to receive(:width=) allow(dsl).to receive(:height=) allow(::Swt::Widgets::Button).to receive(:new) { real } end @@ -34,12 +32,10 @@ let(:height) {20} let(:size) {double 'real size', x: width, y: height} let(:real) {double('button real', size: size, pack: true).as_null_object} before :each do - allow(parent).to receive(:real) - allow(parent).to receive(:dsl){double(contents: [])} allow(::Swt::Widgets::Button).to receive(:new) { real } end def dsl_for_dimensions(width, height) double('dsl', element_width: width, element_height: height, text: text).as_null_object @@ -48,10 +44,10 @@ def with_dimensions_real_should_be(input_width, input_height, expected_width, expected_height) dsl = dsl_for_dimensions input_width, input_height expect(dsl).to receive(:element_width=).with(expected_width) unless input_width expect(dsl).to receive(:element_height=).with(expected_height) unless input_height - Shoes::Swt::Button.new dsl, parent + Shoes::Swt::Button.new dsl, swt_app end it 'uses only real when width and height are not specified' do with_dimensions_real_should_be nil, nil, real.size.x, real.size.y end