shoes-core 4.0.0.pre7 → 4.0.0.pre8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shoes/arc.rb +10 -13
  3. data/lib/shoes/arrow.rb +1 -11
  4. data/lib/shoes/background.rb +0 -3
  5. data/lib/shoes/border.rb +0 -3
  6. data/lib/shoes/button.rb +4 -1
  7. data/lib/shoes/check_button.rb +0 -1
  8. data/lib/shoes/common/art_element.rb +21 -0
  9. data/lib/shoes/common/background_element.rb +10 -0
  10. data/lib/shoes/common/clickable.rb +2 -0
  11. data/lib/shoes/common/rotate.rb +1 -2
  12. data/lib/shoes/common/ui_element.rb +10 -1
  13. data/lib/shoes/core/version.rb +1 -1
  14. data/lib/shoes/download.rb +47 -29
  15. data/lib/shoes/dsl.rb +99 -40
  16. data/lib/shoes/font.rb +0 -4
  17. data/lib/shoes/http_request.rb +91 -0
  18. data/lib/shoes/image.rb +0 -1
  19. data/lib/shoes/input_box.rb +0 -1
  20. data/lib/shoes/internal_app.rb +1 -1
  21. data/lib/shoes/line.rb +25 -11
  22. data/lib/shoes/link.rb +10 -4
  23. data/lib/shoes/list_box.rb +0 -1
  24. data/lib/shoes/mock/app.rb +6 -0
  25. data/lib/shoes/mock/clickable.rb +3 -0
  26. data/lib/shoes/mock/font.rb +0 -4
  27. data/lib/shoes/oval.rb +3 -13
  28. data/lib/shoes/progress.rb +0 -1
  29. data/lib/shoes/rect.rb +1 -11
  30. data/lib/shoes/shape.rb +16 -8
  31. data/lib/shoes/slot.rb +2 -1
  32. data/lib/shoes/star.rb +8 -11
  33. data/lib/shoes/text_block.rb +0 -1
  34. data/lib/shoes/ui/picker.rb +29 -8
  35. data/lib/shoes/version.rb +1 -1
  36. metadata +8 -231
  37. data/Guardfile +0 -5
  38. data/Rakefile +0 -1
  39. data/bin/shoes-stub +0 -62
  40. data/ext/install/Rakefile +0 -39
  41. data/ext/install/shoes.bat +0 -17
  42. data/lib/rubygems_plugin.rb +0 -24
  43. data/shoes-core.gemspec +0 -22
  44. data/spec/shoes/animation_spec.rb +0 -71
  45. data/spec/shoes/app_spec.rb +0 -454
  46. data/spec/shoes/arc_spec.rb +0 -52
  47. data/spec/shoes/arrow_spec.rb +0 -28
  48. data/spec/shoes/background_spec.rb +0 -47
  49. data/spec/shoes/border_spec.rb +0 -46
  50. data/spec/shoes/builtin_methods_spec.rb +0 -122
  51. data/spec/shoes/button_spec.rb +0 -55
  52. data/spec/shoes/check_spec.rb +0 -36
  53. data/spec/shoes/color_spec.rb +0 -429
  54. data/spec/shoes/common/attachable_spec.rb +0 -32
  55. data/spec/shoes/common/inspect_spec.rb +0 -26
  56. data/spec/shoes/common/remove_spec.rb +0 -37
  57. data/spec/shoes/common/rotate_spec.rb +0 -13
  58. data/spec/shoes/common/style_normalizer_spec.rb +0 -28
  59. data/spec/shoes/common/style_spec.rb +0 -197
  60. data/spec/shoes/common/translate_spec.rb +0 -27
  61. data/spec/shoes/configuration_spec.rb +0 -51
  62. data/spec/shoes/constants_spec.rb +0 -39
  63. data/spec/shoes/dialog_spec.rb +0 -169
  64. data/spec/shoes/dimension_spec.rb +0 -451
  65. data/spec/shoes/dimensions_spec.rb +0 -868
  66. data/spec/shoes/download_spec.rb +0 -198
  67. data/spec/shoes/flow_spec.rb +0 -132
  68. data/spec/shoes/font_spec.rb +0 -36
  69. data/spec/shoes/framework_learning_spec.rb +0 -31
  70. data/spec/shoes/gradient_spec.rb +0 -31
  71. data/spec/shoes/helpers/fake_absolute_element.rb +0 -31
  72. data/spec/shoes/helpers/fake_element.rb +0 -25
  73. data/spec/shoes/helpers/inspect_helpers.rb +0 -5
  74. data/spec/shoes/helpers/sample17_helper.rb +0 -65
  75. data/spec/shoes/image_spec.rb +0 -69
  76. data/spec/shoes/images/shoe.jpg +0 -0
  77. data/spec/shoes/input_box_spec.rb +0 -80
  78. data/spec/shoes/integration_spec.rb +0 -19
  79. data/spec/shoes/internal_app_spec.rb +0 -148
  80. data/spec/shoes/keypress_spec.rb +0 -11
  81. data/spec/shoes/keyrelease_spec.rb +0 -11
  82. data/spec/shoes/line_spec.rb +0 -120
  83. data/spec/shoes/link_spec.rb +0 -149
  84. data/spec/shoes/list_box_spec.rb +0 -87
  85. data/spec/shoes/logger/ruby_spec.rb +0 -8
  86. data/spec/shoes/logger_spec.rb +0 -45
  87. data/spec/shoes/oval_spec.rb +0 -25
  88. data/spec/shoes/packager_spec.rb +0 -25
  89. data/spec/shoes/point_spec.rb +0 -99
  90. data/spec/shoes/progress_spec.rb +0 -54
  91. data/spec/shoes/radio_spec.rb +0 -32
  92. data/spec/shoes/rect_spec.rb +0 -40
  93. data/spec/shoes/renamed_delegate_spec.rb +0 -69
  94. data/spec/shoes/shape_spec.rb +0 -119
  95. data/spec/shoes/shared_examples/button.rb +0 -6
  96. data/spec/shoes/shared_examples/changeable.rb +0 -26
  97. data/spec/shoes/shared_examples/clickable.rb +0 -5
  98. data/spec/shoes/shared_examples/common_methods.rb +0 -35
  99. data/spec/shoes/shared_examples/dimensions.rb +0 -32
  100. data/spec/shoes/shared_examples/dsl.rb +0 -44
  101. data/spec/shoes/shared_examples/dsl/animate.rb +0 -29
  102. data/spec/shoes/shared_examples/dsl/arc.rb +0 -45
  103. data/spec/shoes/shared_examples/dsl/background.rb +0 -26
  104. data/spec/shoes/shared_examples/dsl/border.rb +0 -10
  105. data/spec/shoes/shared_examples/dsl/button.rb +0 -5
  106. data/spec/shoes/shared_examples/dsl/cap.rb +0 -6
  107. data/spec/shoes/shared_examples/dsl/check.rb +0 -11
  108. data/spec/shoes/shared_examples/dsl/edit_box.rb +0 -8
  109. data/spec/shoes/shared_examples/dsl/edit_line.rb +0 -8
  110. data/spec/shoes/shared_examples/dsl/editable_element.rb +0 -29
  111. data/spec/shoes/shared_examples/dsl/fill.rb +0 -27
  112. data/spec/shoes/shared_examples/dsl/flow.rb +0 -15
  113. data/spec/shoes/shared_examples/dsl/gradient.rb +0 -62
  114. data/spec/shoes/shared_examples/dsl/image.rb +0 -21
  115. data/spec/shoes/shared_examples/dsl/line.rb +0 -9
  116. data/spec/shoes/shared_examples/dsl/nofill.rb +0 -6
  117. data/spec/shoes/shared_examples/dsl/nostroke.rb +0 -6
  118. data/spec/shoes/shared_examples/dsl/oval.rb +0 -88
  119. data/spec/shoes/shared_examples/dsl/pattern.rb +0 -34
  120. data/spec/shoes/shared_examples/dsl/progress.rb +0 -7
  121. data/spec/shoes/shared_examples/dsl/rect.rb +0 -92
  122. data/spec/shoes/shared_examples/dsl/rgb.rb +0 -28
  123. data/spec/shoes/shared_examples/dsl/shape.rb +0 -61
  124. data/spec/shoes/shared_examples/dsl/star.rb +0 -110
  125. data/spec/shoes/shared_examples/dsl/stroke.rb +0 -30
  126. data/spec/shoes/shared_examples/dsl/strokewidth.rb +0 -19
  127. data/spec/shoes/shared_examples/dsl/style.rb +0 -32
  128. data/spec/shoes/shared_examples/dsl/text_elements.rb +0 -84
  129. data/spec/shoes/shared_examples/dsl/video.rb +0 -5
  130. data/spec/shoes/shared_examples/dsl_app_context.rb +0 -11
  131. data/spec/shoes/shared_examples/hover.rb +0 -78
  132. data/spec/shoes/shared_examples/parent.rb +0 -6
  133. data/spec/shoes/shared_examples/scroll.rb +0 -41
  134. data/spec/shoes/shared_examples/shared_element_method.rb +0 -60
  135. data/spec/shoes/shared_examples/slot.rb +0 -441
  136. data/spec/shoes/shared_examples/state.rb +0 -26
  137. data/spec/shoes/shared_examples/style.rb +0 -77
  138. data/spec/shoes/slot_spec.rb +0 -176
  139. data/spec/shoes/sound_spec.rb +0 -16
  140. data/spec/shoes/span_spec.rb +0 -112
  141. data/spec/shoes/spec_helper.rb +0 -24
  142. data/spec/shoes/stack_spec.rb +0 -79
  143. data/spec/shoes/star_spec.rb +0 -49
  144. data/spec/shoes/text_block_dimensions_spec.rb +0 -77
  145. data/spec/shoes/text_block_spec.rb +0 -314
  146. data/spec/shoes/text_spec.rb +0 -22
  147. data/spec/shoes/ui/picker_spec.rb +0 -69
  148. data/spec/shoes/url_spec.rb +0 -67
  149. data/spec/shoes/widget_spec.rb +0 -78
  150. data/spec/shoes_spec.rb +0 -41
  151. data/spec/spec_helper.rb +0 -27
data/shoes-core.gemspec DELETED
@@ -1,22 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('lib/shoes/core/version')
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "shoes-core"
6
- s.version = Shoes::Core::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = ["Team Shoes"]
9
- s.email = ["shoes@librelist.com"]
10
- s.homepage = "https://github.com/shoes/shoes4"
11
- s.summary = 'The best little DSL for the best little GUI toolkit for Ruby.'
12
- s.description = "Shoes is the best little GUI toolkit for Ruby. Shoes makes building for Mac, Windows, and Linux super simple. This is the DSL for writing your app. You'll need a backend to run it."
13
- s.license = 'MIT'
14
-
15
- s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
- s.require_paths = ["lib"]
18
-
19
- # Curious why we don't install shoes? See ext/Rakefile for the nitty-gritty.
20
- s.executables = ['shoes-picker', 'shoes-stub']
21
- s.extensions = ['ext/install/Rakefile']
22
- end
@@ -1,71 +0,0 @@
1
- require 'spec_helper'
2
-
3
- shared_examples_for Shoes::Animation do
4
- it "should start" do
5
- subject.start
6
- expect(subject).not_to be_stopped
7
- end
8
-
9
- it "should stop" do
10
- subject.stop
11
- expect(subject).to be_stopped
12
- end
13
-
14
- it "should toggle on" do
15
- subject.stop
16
- subject.toggle
17
- expect(subject).not_to be_stopped
18
- end
19
-
20
- it "should toggle off" do
21
- subject.start
22
- subject.toggle
23
- expect(subject).to be_stopped
24
- end
25
-
26
- it "increments frame" do
27
- frame = subject.current_frame
28
- subject.increment_frame
29
- expect(subject.current_frame).to eq(frame + 1)
30
- end
31
- end
32
-
33
- describe Shoes::Animation do
34
- let(:app) { double('app', current_slot: slot) }
35
- let(:slot) { double('slot', create_bound_block: bound_block) }
36
- let(:app_gui) { double('app gui') }
37
- let(:opts) { {} }
38
- let(:block) { double('block') }
39
- let(:bound_block) { double('bound block') }
40
- subject { Shoes::Animation.new(app, opts, block) }
41
-
42
- before :each do
43
- expect(app).to receive(:gui) { app_gui }
44
- end
45
-
46
- it_behaves_like Shoes::Animation
47
-
48
- it "sets default framerate" do
49
- expect(subject.framerate).to eq(10)
50
- end
51
-
52
- it "sets current frame to 0" do
53
- expect(subject.current_frame).to eq(0)
54
- end
55
-
56
- it "calls through slot's context" do
57
- expect(subject.blk).to eq(bound_block)
58
- end
59
-
60
- it { is_expected.not_to be_stopped }
61
-
62
- describe "with framerate" do
63
- let(:opts) { {framerate: 36, app: app} }
64
-
65
- it "sets framerate" do
66
- expect(subject.framerate).to eq(36)
67
- end
68
-
69
- it_behaves_like Shoes::Animation
70
- end
71
- end
@@ -1,454 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Shoes::App do
4
- let(:input_blk) { proc {} }
5
- let(:opts) { Hash.new }
6
- subject(:app) { Shoes::App.new(opts, &input_blk) }
7
-
8
- after do
9
- Shoes.unregister_all
10
- end
11
-
12
- it_behaves_like "DSL container"
13
- it { is_expected.to respond_to :clipboard }
14
- it { is_expected.to respond_to :clipboard= }
15
- it { is_expected.to respond_to :owner }
16
-
17
- # For Shoes 3 compatibility
18
- it "exposes self as #app" do
19
- expect(app.app).to eq(app)
20
- end
21
-
22
- describe "initialize" do
23
- let(:input_blk) { proc {} }
24
-
25
- it "initializes style hash", :qt do
26
- style = Shoes::App.new.style
27
- expect(style.class).to eq(Hash)
28
- end
29
-
30
- context "console" do
31
- end
32
-
33
- context "defaults" do
34
- let(:opts) { Hash.new }
35
- let(:defaults) { Shoes::InternalApp::DEFAULT_OPTIONS }
36
-
37
- it "sets width", :qt do
38
- expect(subject.width).to eq defaults[:width]
39
- end
40
-
41
- it "sets height", :qt do
42
- expect(subject.height).to eq defaults[:height]
43
- end
44
-
45
- it 'has an absolute_left of 0' do
46
- expect(subject.absolute_left).to eq 0
47
- end
48
-
49
- it 'has an absolute_top of 0' do
50
- expect(subject.absolute_top).to eq 0
51
- end
52
-
53
- describe "inspect" do
54
- include InspectHelpers
55
-
56
- it "shows title in #to_s" do
57
- expect(subject.to_s).to eq("(Shoes::App \"#{defaults.fetch :title}\")")
58
- end
59
-
60
- it "shows title in #inspect" do
61
- expect(subject.inspect).to match(/\(Shoes::App:#{shoes_object_id_pattern} "#{defaults.fetch :title}"\)/)
62
- end
63
- end
64
- end
65
-
66
- context "from opts" do
67
- let(:opts) { {width: 150, height: 2, title: "Shoes::App Spec", resizable: false} }
68
-
69
- it "sets width", :qt do
70
- expect(subject.width).to eq opts[:width]
71
- end
72
-
73
- it "sets height", :qt do
74
- expect(subject.height).to eq opts[:height]
75
- end
76
-
77
- it "passes opts to InternalApp" do
78
- expect(Shoes::InternalApp).to receive(:new).with(kind_of(Shoes::App), opts).and_call_original
79
- subject
80
- end
81
-
82
- it 'initializes a flow with the right parameters' do
83
- expect(Shoes::Flow).to receive(:new).with(anything, anything,
84
- width: opts[:width],
85
- height: opts[:height])
86
- .and_call_original
87
- subject
88
- end
89
- end
90
-
91
- context "when registering" do
92
- before :each do
93
- Shoes.unregister_all
94
- end
95
-
96
- it "registers" do
97
- old_apps_length = Shoes.apps.length
98
- subject
99
- expect(Shoes.apps.length).to eq(old_apps_length + 1)
100
- expect(Shoes.apps).to include(subject)
101
- end
102
- end
103
- end
104
-
105
- describe "style with defaults" do
106
- let(:default_styles) { Shoes::Common::Style::DEFAULT_STYLES }
107
-
108
- it "sets app defaults" do
109
- expect(app.style).to eq(default_styles)
110
- end
111
-
112
- it "merges new styles with existing styles" do
113
- subject.style strokewidth: 4
114
- expect(subject.style).to eq(default_styles.merge(strokewidth: 4))
115
- end
116
-
117
- default_styles = Shoes::Common::Style::DEFAULT_STYLES
118
-
119
- default_styles.each do |key, value|
120
- describe key.to_s do
121
- it "defaults to #{value}" do
122
- expect(subject.style[key]).to eq(value)
123
- end
124
-
125
- it "passes default to objects" do
126
- expect(subject.line(0, 100, 100, 0).style[key]).to eq(value)
127
- end
128
- end
129
- end
130
-
131
- describe "default styles" do
132
- it "are independent among Shoes::App instances" do
133
- app1 = Shoes::App.new
134
- app2 = Shoes::App.new
135
-
136
- app1.strokewidth 10
137
- expect(app1.line(0, 100, 100, 0).style[:strokewidth]).to eq(10)
138
-
139
- # .. but does not affect app2
140
- expect(app2.line(0, 100, 100, 0).style[:strokewidth]).not_to eq(10)
141
- end
142
- end
143
- end
144
-
145
- describe "app-level style setter" do
146
- let(:goldenrod) { Shoes::COLORS[:goldenrod] }
147
-
148
- pattern_styles = Shoes::DSL::PATTERN_APP_STYLES
149
- other_styles = Shoes::DSL::OTHER_APP_STYLES
150
-
151
- pattern_styles.each do |style|
152
- it "sets #{style} for objects" do
153
- subject.public_send(style, goldenrod)
154
- expect(subject.line(0, 100, 100, 0).style[style]).to eq(goldenrod)
155
- end
156
- end
157
-
158
- other_styles.each do |style|
159
- it "sets #{style} for objects" do
160
- subject.public_send(style, 'val')
161
- expect(subject.line(0, 100, 100, 0).style[style]).to eq('val')
162
- end
163
- end
164
- end
165
-
166
- describe "connecting with gui" do
167
- let(:gui) { app.instance_variable_get(:@__app__).gui }
168
-
169
- describe "clipboard" do
170
- it "gets clipboard" do
171
- expect(gui).to receive(:clipboard)
172
- subject.clipboard
173
- end
174
-
175
- it "sets clipboard" do
176
- expect(gui).to receive(:clipboard=).with("test")
177
- subject.clipboard = "test"
178
- end
179
- end
180
-
181
- describe "quitting" do
182
- it "#quit tells the GUI to quit" do
183
- expect(gui).to receive :quit
184
- subject.quit
185
- end
186
-
187
- it '#close tells the GUI to quit' do
188
- expect(gui).to receive :quit
189
- subject.close
190
- end
191
- end
192
- end
193
-
194
- describe "#started?" do
195
- it "checks the window has been displayed or not" do
196
- subject.started?
197
- end
198
- end
199
-
200
- describe 'Execution context' do
201
- it 'starts with self as the execution context' do
202
- my_self = nil
203
- app = Shoes.app { my_self = self }
204
- expect(my_self).to eq app
205
- end
206
- end
207
-
208
- describe '#append' do
209
- let(:input_blk) { proc { append { para 'Hi' } } }
210
-
211
- it 'understands append' do
212
- expect(subject).to respond_to :append
213
- end
214
-
215
- it 'should receive a call to what is called in the append block' do
216
- expect_any_instance_of(Shoes::App).to receive :para
217
- subject
218
- end
219
- end
220
-
221
- describe '#resize' do
222
- it 'understands resize' do
223
- expect(subject).to respond_to :resize
224
- end
225
- end
226
-
227
- describe 'fullscreen' do
228
- context 'defaults' do
229
- it 'is not fullscreen' do
230
- expect(app).not_to be_fullscreen
231
- end
232
-
233
- it 'can enter fullscreen', :fullscreen do
234
- app.fullscreen = true
235
- expect(app).to be_fullscreen
236
- end
237
- end
238
-
239
- describe 'going into fullscreen and back out again' do
240
- let(:defaults) { Shoes::InternalApp::DEFAULT_OPTIONS }
241
-
242
- before :each do
243
- app.fullscreen = true
244
- app.fullscreen = false
245
- end
246
-
247
- it 'is not in fullscreen', :fullscreen do
248
- expect(app).not_to be_fullscreen
249
- end
250
-
251
- it 'has its original', :fullscreen do
252
- expect(app.width).to eq(defaults[:width])
253
- end
254
-
255
- it 'has its original height', :fullscreen do
256
- expect(app.height).to eq(defaults[:height])
257
- end
258
- end
259
- end
260
-
261
- describe '#clear' do
262
- let(:input_blk) do
263
- proc do
264
- para 'Hello'
265
- end
266
- end
267
- let(:internal_app) { subject.instance_variable_get(:@__app__) }
268
-
269
- it 'has initial contents' do
270
- expect(subject.contents).to_not be_empty
271
- end
272
-
273
- it 'removes everything (regression)' do
274
- subject.clear
275
- expect(subject.contents).to be_empty
276
- end
277
- end
278
-
279
- describe "#parent" do
280
- context "for a top-level element (not explicitly in a slot)" do
281
- it "returns the top_slot" do
282
- my_parent = nil
283
- app = Shoes.app do
284
- flow do
285
- my_parent = parent
286
- end
287
- end
288
- expect(my_parent).to eq app.instance_variable_get(:@__app__).top_slot
289
- end
290
- end
291
-
292
- context "for an element within a slot" do
293
- it "returns the enclosing slot" do
294
- my_parent = nil
295
- my_stack = nil
296
- Shoes.app do
297
- my_stack = stack do
298
- flow do
299
- my_parent = parent
300
- end
301
- end
302
- end
303
-
304
- expect(my_parent).to eq my_stack
305
- end
306
- end
307
- end
308
-
309
- describe "additional context" do
310
- it "fails on unknown method" do
311
- expect { subject.asdf }.to raise_error(NoMethodError)
312
- end
313
-
314
- it "calls through to context if available" do
315
- context = double("context", asdf: nil)
316
- expect(context).to receive(:asdf)
317
-
318
- subject.eval_with_additional_context(context) do
319
- asdf
320
- end
321
- end
322
-
323
- it "clears context when finished" do
324
- context = double("context")
325
-
326
- captured_context = nil
327
- subject.eval_with_additional_context(context) do
328
- captured_context = @__additional_context__
329
- end
330
-
331
- expect(captured_context).to eq(context)
332
- expect(subject.instance_variable_get(:@__additional_context__)).to be_nil
333
- end
334
-
335
- it "still clears context when failure in eval" do
336
- context = double("context")
337
-
338
- expect do
339
- subject.eval_with_additional_context(context) { raise "O_o" }
340
- end.to raise_error(RuntimeError)
341
-
342
- expect(subject.instance_variable_get(:@__additional_context__)).to be_nil
343
- end
344
- end
345
-
346
- describe 'subscribing to DSL methods' do
347
- class TestSubscribeClass
348
- attr_reader :app
349
- def initialize(app)
350
- @app = app
351
- end
352
- Shoes::App.subscribe_to_dsl_methods(self)
353
- end
354
-
355
- let(:subscribed_instance) { TestSubscribeClass.new subject }
356
-
357
- AUTO_SUBSCRIBED_CLASSES = [Shoes::App, Shoes::URL, Shoes::Widget].freeze
358
- SUBSCRIBED_CLASSES = AUTO_SUBSCRIBED_CLASSES + [TestSubscribeClass]
359
-
360
- describe '.subscribe_to_dsl_methods' do
361
- it 'has its instances respond to the dsl methods of the app' do
362
- expect(subscribed_instance).to respond_to :para, :image
363
- end
364
-
365
- it 'delegates does methods to the passed in app' do
366
- expect(subject).to receive(:para)
367
- subscribed_instance.para
368
- end
369
-
370
- SUBSCRIBED_CLASSES.each do |klazz|
371
- it "#{klazz} responds to a regular DSL method" do
372
- expect(klazz).to be_public_method_defined(:para)
373
- end
374
- end
375
- end
376
-
377
- describe '.new_dsl_method (for widget method notifications etc.)' do
378
- before :each do
379
- Shoes::App.new_dsl_method :widget_method do
380
- # noop
381
- end
382
- end
383
-
384
- SUBSCRIBED_CLASSES.each do |klazz|
385
- it "#{klazz} now responds to this method" do
386
- expect(klazz).to be_public_method_defined(:widget_method)
387
- end
388
- end
389
- end
390
-
391
- describe 'DELEGATE_METHODS' do
392
- subject { Shoes::App::DELEGATE_METHODS }
393
-
394
- describe 'does not include general ruby object methods' do
395
- it { is_expected.not_to include :new, :initialize }
396
- end
397
-
398
- describe 'it has access to Shoes app and DSL methods' do
399
- it { is_expected.to include :para, :rect, :stack, :flow, :image, :location }
400
- end
401
-
402
- describe 'it does not have access to private methods' do
403
- it { is_expected.not_to include :pop_style, :style_normalizer, :create }
404
- end
405
-
406
- describe 'there are blacklisted methods that wreck havoc' do
407
- it { is_expected.not_to include :parent, :app }
408
- end
409
- end
410
- end
411
- end
412
-
413
- describe "App registry" do
414
- subject { Shoes.apps }
415
-
416
- before :each do
417
- Shoes.unregister_all
418
- end
419
-
420
- it "only exposes a copy" do
421
- subject << double("app")
422
- expect(Shoes.apps.length).to eq(0)
423
- end
424
-
425
- context "with no apps" do
426
- it { is_expected.to be_empty }
427
- end
428
-
429
- context "with one app" do
430
- let(:app) { double('app') }
431
- before :each do
432
- Shoes.register(app)
433
- end
434
-
435
- its(:length) { should eq(1) }
436
- it "marks first app as main app" do
437
- expect(Shoes.main_app).to be(app)
438
- end
439
- end
440
-
441
- context "with two apps" do
442
- let(:app_1) { double("app 1") }
443
- let(:app_2) { double("app 2") }
444
-
445
- before :each do
446
- [app_1, app_2].each { |a| Shoes.register(a) }
447
- end
448
-
449
- its(:length) { should eq(2) }
450
- it "marks first app as main app" do
451
- expect(Shoes.main_app).to be(app_1)
452
- end
453
- end
454
- end