spec/shoes/swt/app_spec.rb in shoes-swt-4.0.0.pre3 vs spec/shoes/swt/app_spec.rb in shoes-swt-4.0.0.pre4
- old
+ new
@@ -1,24 +1,25 @@
require "shoes/swt/spec_helper"
describe Shoes::Swt::App do
let(:opts) { {:background => Shoes::COLORS[:salmon], :resizable => true} }
- let(:app) { double('app', :opts => opts,
- :width => width,
- :height => 0,
- :app_title => 'double') }
- let(:dsl) { app }
+ let(:app) { double('app') }
+ let(:dsl) { double('dsl', :app => app,
+ :opts => opts,
+ :width => width,
+ :height => 0,
+ :app_title => 'double') }
let(:opts_unresizable) { {:background => Shoes::COLORS[:salmon],
:resizable => false} }
let(:app_unresizable) { double('app', :opts => opts_unresizable,
:width => 0,
:height => 0,
:app_title => 'double') }
let(:width) {0}
- subject { Shoes::Swt::App.new(app) }
+ subject { Shoes::Swt::App.new(dsl) }
it { is_expected.to respond_to :clipboard }
it { is_expected.to respond_to :clipboard= }
it_behaves_like "clickable backend" do
@@ -40,9 +41,17 @@
it "registers" do
old_apps_length = Shoes::Swt.apps.length
subject
expect(Shoes::Swt.apps.length).to eq(old_apps_length + 1)
expect(Shoes::Swt.apps.include?(subject)).to be_truthy
+ end
+
+ it "unregisters" do
+ old_apps_length = Shoes::Swt.apps.length
+ expect(Shoes).to receive(:unregister)
+
+ subject.send(:unregister_app).call()
+ expect(Shoes::Swt.apps.length).to eq(old_apps_length)
end
end
context "when running on a mac" do
let(:the_display) { ::Swt::Widgets::Display }