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

- old
+ new

@@ -1,21 +1,21 @@ -require 'shoes/swt/spec_helper' +require 'spec_helper' describe Shoes::Swt::InputBox do include_context "swt app" let(:dsl) { double('dsl', app: shoes_app, visible?: true, element_width: 80, element_height: 22, initial_text: 'Jay', secret?: secret, call_change_listeners: true).as_null_object } let(:real) { double('real', disposed?: false, text: text, - add_modify_listener: true).as_null_object } + add_modify_listener: true).as_null_object } let(:styles) {::Swt::SWT::SINGLE | ::Swt::SWT::BORDER} let(:secret) {false} let(:text) {'Some text...'} - subject { Shoes::Swt::InputBox.new dsl, parent, styles } + subject { Shoes::Swt::InputBox.new dsl, swt_app, styles } before :each do allow(::Swt::Widgets::Text).to receive(:new) { real } allow(::Swt::Widgets::Text).to receive(:text=) { real } end @@ -31,11 +31,10 @@ subject.text = "some text" expect(real).to have_received(:text=).with("some text") end describe 'change listeners' do - it "should set up a listener that delegates change events" do expect(dsl).to receive(:call_change_listeners) expect(real).to receive(:add_modify_listener) do |&blk| blk.call(event) end @@ -72,11 +71,10 @@ end @modify_block.call event expect(dsl).to_not have_received :call_change_listeners end end - end end end describe 'text selections' do @@ -90,25 +88,25 @@ expect(real).to have_received(:set_selection).with(42) end end describe Shoes::Swt::EditLine do - subject {Shoes::Swt::EditLine.new dsl, parent} + subject {Shoes::Swt::EditLine.new dsl, swt_app} describe ":secret option" do context "when NOT set" do it "does NOT set PASSWORD style" do options = Shoes::Swt::EditLine::DEFAULT_STYLES allow(dsl).to receive(:secret?) { false } - expect(::Swt::Widgets::Text).to receive(:new).with(parent.real, options) + expect(::Swt::Widgets::Text).to receive(:new).with(swt_app.real, options) subject end end context "when set" do it "sets PASSWORD style" do options = Shoes::Swt::EditLine::DEFAULT_STYLES | ::Swt::SWT::PASSWORD allow(dsl).to receive(:secret?) { true } - expect(::Swt::Widgets::Text).to receive(:new).with(parent.real, options) + expect(::Swt::Widgets::Text).to receive(:new).with(swt_app.real, options) subject end end end end