osaka 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +32 -8
- data/lib/osaka/calculator.rb +10 -9
- data/lib/osaka/keynote.rb +4 -4
- data/lib/osaka/location.rb +4 -0
- data/lib/osaka/numbers.rb +1 -1
- data/lib/osaka/osakaexpectations.rb +132 -0
- data/lib/osaka/pages.rb +13 -13
- data/lib/osaka/{applicationwrapper.rb → remotecontrol.rb} +68 -31
- data/lib/osaka/scriptrunner.rb +9 -1
- data/lib/osaka/textedit.rb +4 -4
- data/lib/osaka/typicalapplication.rb +49 -107
- data/lib/osaka/typicalprintdialog.rb +32 -0
- data/lib/osaka/typicalsavedialog.rb +33 -0
- data/lib/osaka/version.rb +1 -1
- data/lib/osaka.rb +4 -2
- data/spec/assets/mail_merge_data.numbers +0 -0
- data/spec/assets/mail_merge_template.pages +0 -0
- data/spec/calculator_spec.rb +10 -12
- data/spec/integration_keynote_spec.rb +1 -0
- data/spec/integration_pages_numbers_mail_merge_spec.rb +1 -1
- data/spec/keynote_flows_spec.rb +4 -4
- data/spec/keynote_spec.rb +4 -4
- data/spec/location_spec.rb +6 -0
- data/spec/mailmergeflow_spec.rb +2 -2
- data/spec/numbers_spec.rb +2 -3
- data/spec/osakaexpectations_spec.rb +26 -0
- data/spec/pages_spec.rb +8 -8
- data/spec/remotecontrol_spec.rb +411 -0
- data/spec/scriptrunner_spec.rb +12 -0
- data/spec/textedit_spec.rb +2 -2
- data/spec/typicalapplication_spec.rb +195 -221
- data/spec/typicalprintdialog_spec.rb +33 -0
- data/spec/typicalsavedialog_spec.rb +51 -0
- metadata +10 -5
- data/lib/osaka/applicationwrapperexpectations.rb +0 -91
- data/spec/applicationwrapper_spec.rb +0 -296
@@ -3,12 +3,12 @@ require 'osaka'
|
|
3
3
|
|
4
4
|
describe "Osaka::TypicalApplication" do
|
5
5
|
|
6
|
-
include(*Osaka::
|
6
|
+
include(*Osaka::OsakaExpectations)
|
7
7
|
|
8
8
|
subject { Osaka::TypicalApplication.new("ApplicationName") }
|
9
9
|
|
10
|
-
let(:
|
11
|
-
|
10
|
+
let(:control) { subject.control = mock("RemoteControl", :name => "ApplicationName", :base_location => "", :mac_version => :mountain_lion) }
|
11
|
+
|
12
12
|
before (:each) do
|
13
13
|
Osaka::ScriptRunner.enable_debug_prints
|
14
14
|
end
|
@@ -17,57 +17,6 @@ describe "Osaka::TypicalApplication" do
|
|
17
17
|
Osaka::ScriptRunner.disable_debug_prints
|
18
18
|
end
|
19
19
|
|
20
|
-
it "Should be able to clone TypicalApplications" do
|
21
|
-
expect_clone
|
22
|
-
subject.clone
|
23
|
-
end
|
24
|
-
|
25
|
-
it "Should pass the right open string to the application osascript" do
|
26
|
-
filename = "filename.key"
|
27
|
-
expect_tell("open \"#{File.absolute_path(filename)}\"")
|
28
|
-
expect_set_current_window(filename)
|
29
|
-
subject.open(filename)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "Should only get the basename of the filename when it sets the window title." do
|
33
|
-
filename = "/root/dirname/filename.key"
|
34
|
-
expect_tell("open \"#{File.absolute_path(filename)}\"")
|
35
|
-
expect_set_current_window("filename.key")
|
36
|
-
subject.open(filename)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "Should be able to quit" do
|
40
|
-
expect_running?.and_return(true)
|
41
|
-
expect_quit
|
42
|
-
subject.quit
|
43
|
-
end
|
44
|
-
|
45
|
-
it "Should be able to check if its running" do
|
46
|
-
expect_running?.and_return(true)
|
47
|
-
subject.running?.should == true
|
48
|
-
end
|
49
|
-
|
50
|
-
it "Won't quit when the application isn't running" do
|
51
|
-
expect_running?.and_return(false)
|
52
|
-
subject.quit(:dont_save)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "Should be able to quit without saving" do
|
56
|
-
expect_running?.and_return(true, true, false)
|
57
|
-
expect_quit
|
58
|
-
expect_exists(at.sheet(1)).and_return(true)
|
59
|
-
expect_click!(at.button("Don’t Save").sheet(1))
|
60
|
-
subject.quit(:dont_save)
|
61
|
-
end
|
62
|
-
|
63
|
-
it "Should be able to create a new document" do
|
64
|
-
subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("new_window")
|
65
|
-
expect_keystroke("n", :command)
|
66
|
-
expect_set_current_window("new_window")
|
67
|
-
expect_focus
|
68
|
-
subject.new_document
|
69
|
-
end
|
70
|
-
|
71
20
|
it "Should be able to do something and wait until a new window pops up" do
|
72
21
|
expect_window_list.and_return(["original window"], ["original window"], ["original window"], ["new window", "original window"])
|
73
22
|
expect_activate
|
@@ -77,208 +26,233 @@ describe "Osaka::TypicalApplication" do
|
|
77
26
|
}.should == "new window"
|
78
27
|
code_block_called.should == true
|
79
28
|
end
|
80
|
-
|
81
|
-
it "Should be able to save" do
|
82
|
-
expect_keystroke("s", :command)
|
83
|
-
subject.save
|
84
|
-
end
|
85
29
|
|
86
|
-
|
87
|
-
subject.should_receive(:duplicate_available?).and_return(false)
|
88
|
-
save_dialog = double("Osaka::TypicalSaveDialog")
|
89
|
-
subject.should_receive(:save_dialog).and_return(save_dialog)
|
90
|
-
save_dialog.should_receive(:save).with("filename")
|
91
|
-
expect_set_current_window("filename")
|
92
|
-
subject.save_as("filename")
|
93
|
-
end
|
94
|
-
|
95
|
-
it "Should be able to save as a file using the duplicate..." do
|
96
|
-
new_instance = mock(:TypicalApplication)
|
97
|
-
new_instance_wrapper = mock(:ApplicationWrapper)
|
98
|
-
save_dialog = double("Osaka::TypicalSaveDialog").as_null_object
|
99
|
-
|
100
|
-
subject.should_receive(:duplicate_available?).and_return(true)
|
101
|
-
subject.should_receive(:duplicate).and_return(new_instance)
|
102
|
-
new_instance.should_receive(:wrapper).and_return(new_instance_wrapper)
|
103
|
-
new_instance_wrapper.should_receive(:clone).and_return(wrapper)
|
30
|
+
context "Cloning and copying" do
|
104
31
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
it "Should be able to check whether Duplicate is supported" do
|
112
|
-
expect_exists(at.menu_item("Duplicate").menu(1).menu_bar_item("File").menu_bar(1)).and_return(true)
|
113
|
-
subject.duplicate_available?.should == true
|
114
|
-
end
|
32
|
+
it "Should be able to clone TypicalApplications" do
|
33
|
+
expect_clone
|
34
|
+
subject.clone
|
35
|
+
end
|
115
36
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
37
|
+
it "Should be able to clone the typical applications and the remote controls will be different" do
|
38
|
+
subject.control.set_current_window "Original"
|
39
|
+
new_instance = subject.clone
|
40
|
+
new_instance.control.set_current_window "Clone"
|
41
|
+
subject.control.current_window_name.should == "Original"
|
42
|
+
end
|
120
43
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
new_instance.should_receive(:wrapper).and_return(wrapper)
|
128
|
-
subject.should_receive(:sleep).with(0.4) # Avoiding Mountain Lion crash
|
129
|
-
expect_keystroke!(:return)
|
130
|
-
expect_set_current_window("New name duplicate window")
|
131
|
-
subject.duplicate.should == new_instance
|
44
|
+
it "Should pass the right open string to the application osascript" do
|
45
|
+
filename = "filename.key"
|
46
|
+
expect_tell("open \"#{File.absolute_path(filename)}\"")
|
47
|
+
expect_set_current_window(filename)
|
48
|
+
subject.open(filename)
|
49
|
+
end
|
132
50
|
end
|
133
51
|
|
134
|
-
|
135
|
-
|
136
|
-
|
52
|
+
context "Opening and new document" do
|
53
|
+
|
54
|
+
it "Should only get the basename of the filename when it sets the window title." do
|
55
|
+
filename = "/root/dirname/filename.key"
|
56
|
+
expect_tell("open \"#{File.absolute_path(filename)}\"")
|
57
|
+
expect_set_current_window("filename.key")
|
58
|
+
subject.open(filename)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "Should be able to create a new document" do
|
62
|
+
subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("new_window")
|
63
|
+
expect_keystroke("n", :command)
|
64
|
+
expect_set_current_window("new_window")
|
65
|
+
expect_focus
|
66
|
+
subject.new_document
|
67
|
+
end
|
68
|
+
|
137
69
|
end
|
138
70
|
|
139
|
-
|
140
|
-
expect_keystroke("w", :command)
|
141
|
-
subject.should_receive(:wait_for_window_and_dialogs_to_close).with(:dont_save)
|
142
|
-
subject.close(:dont_save)
|
143
|
-
end
|
71
|
+
context "Quiting and closing and checking whether the app is still running" do
|
144
72
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
73
|
+
it "Should be able to quit" do
|
74
|
+
expect_running?.and_return(true)
|
75
|
+
expect_quit
|
76
|
+
subject.quit
|
77
|
+
end
|
149
78
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
79
|
+
it "Should be able to check if its running" do
|
80
|
+
expect_running?.and_return(true)
|
81
|
+
subject.running?.should be_true
|
82
|
+
end
|
154
83
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
84
|
+
it "Won't quit when the application isn't running" do
|
85
|
+
expect_running?.and_return(false)
|
86
|
+
subject.quit(:dont_save)
|
87
|
+
end
|
159
88
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
89
|
+
it "Should be able to quit without saving" do
|
90
|
+
expect_running?.and_return(true, true, false)
|
91
|
+
expect_quit
|
92
|
+
expect_exists?(at.sheet(1)).and_return(true)
|
93
|
+
expect_click!(at.button("Don’t Save").sheet(1))
|
94
|
+
subject.quit(:dont_save)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "Should be able to close" do
|
98
|
+
expect_keystroke("w", :command)
|
99
|
+
subject.close
|
100
|
+
end
|
164
101
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
it "Should be able to select all" do
|
171
|
-
expect_keystroke("a", :command)
|
172
|
-
subject.select_all
|
173
|
-
end
|
174
|
-
|
175
|
-
it "Should be able to retrieve a print dialog" do
|
176
|
-
expect_keystroke("p", :command)
|
177
|
-
expect_wait_until_exists(at.sheet(1))
|
178
|
-
subject.print_dialog
|
179
|
-
end
|
180
|
-
|
181
|
-
it "Should be able to check whether the save will pop up a dialog or not" do
|
182
|
-
expect_exists(at.menu_item("Save…").menu(1).menu_bar_item("File").menu_bar(1)).and_return(true)
|
183
|
-
subject.save_pops_up_dialog?.should == true
|
184
|
-
end
|
185
|
-
|
186
|
-
it "Should be able to retrieve a save dialog by using save as" do
|
187
|
-
subject.should_receive(:save_pops_up_dialog?).and_return(false)
|
188
|
-
expect_keystroke("s", [:command, :shift])
|
189
|
-
expect_wait_until_exists(at.sheet(1))
|
190
|
-
subject.save_dialog
|
191
|
-
end
|
192
|
-
|
193
|
-
it "Should be able to retrieve a save dialog using duplicate and save" do
|
194
|
-
subject.should_receive(:save_pops_up_dialog?).and_return(true)
|
195
|
-
subject.should_receive(:save)
|
196
|
-
expect_wait_until_exists(at.sheet(1))
|
197
|
-
subject.save_dialog
|
198
|
-
end
|
199
|
-
|
200
|
-
describe "Application info" do
|
201
|
-
it "Should be able to retrieve an application info object and parse it" do
|
202
|
-
expect_tell('get info for (path to application "ApplicationName")').and_return('name:ApplicationName.app, creation date:date "Sunday, December 21, 2008 PM 06:14:11"}')
|
203
|
-
app_info = subject.get_info
|
204
|
-
app_info.name.should == "ApplicationName.app"
|
102
|
+
it "Should be able to close and don't save" do
|
103
|
+
expect_keystroke("w", :command)
|
104
|
+
subject.should_receive(:wait_for_window_and_dialogs_to_close).with(:dont_save)
|
105
|
+
subject.close(:dont_save)
|
205
106
|
end
|
107
|
+
|
206
108
|
end
|
207
109
|
|
208
|
-
|
110
|
+
context "Save and duplicate documents" do
|
209
111
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
112
|
+
let(:save_dialog) { mock("Typical Save Dialog") }
|
113
|
+
let(:new_instance_control) { mock("RemoteControl") }
|
114
|
+
|
115
|
+
it "Should be able to save" do
|
116
|
+
expect_keystroke("s", :command)
|
117
|
+
subject.save
|
118
|
+
end
|
119
|
+
|
120
|
+
it "Should be able to save as a file without duplicate being available" do
|
121
|
+
subject.should_receive(:duplicate_available?).and_return(false)
|
214
122
|
|
215
|
-
|
216
|
-
|
123
|
+
subject.should_receive(:save_dialog).and_return(save_dialog)
|
124
|
+
save_dialog.should_receive(:save).with("filename")
|
125
|
+
expect_set_current_window("filename")
|
217
126
|
|
218
|
-
|
219
|
-
|
127
|
+
subject.save_as("filename")
|
128
|
+
end
|
129
|
+
|
130
|
+
it "Should be able to save as a file using the duplicate..." do
|
131
|
+
subject.should_receive(:duplicate_available?).and_return(true)
|
220
132
|
|
221
|
-
subject.
|
222
|
-
|
133
|
+
subject.stub_chain(:duplicate, :control, :clone).and_return(new_instance_control)
|
134
|
+
subject.should_receive(:close)
|
135
|
+
subject.stub_chain(:save_dialog, :save)
|
136
|
+
new_instance_control.should_receive(:set_current_window).with("filename")
|
223
137
|
|
224
|
-
|
225
|
-
|
226
|
-
|
138
|
+
subject.save_as("filename")
|
139
|
+
subject.control.should equal(new_instance_control)
|
140
|
+
end
|
141
|
+
|
142
|
+
it "Should be able to check whether Duplicate is supported" do
|
143
|
+
expect_exists?(at.menu_item("Duplicate").menu(1).menu_bar_item("File").menu_bar(1)).and_return(true)
|
144
|
+
subject.duplicate_available?.should == true
|
145
|
+
end
|
146
|
+
|
147
|
+
it "Should throw an exception when duplicate is not available"do
|
148
|
+
subject.should_receive(:duplicate_available?).and_return(false)
|
149
|
+
lambda {subject.duplicate}.should raise_error(Osaka::VersioningError, "MacOS Versioning Error: Duplicate is not available on this Mac version")
|
150
|
+
end
|
151
|
+
|
152
|
+
it "Should return a new keynote instance variable after duplication (Lion!)" do
|
153
|
+
simulate_mac_version(:lion)
|
154
|
+
subject.should_receive(:duplicate_available?).and_return(true)
|
227
155
|
|
228
|
-
|
156
|
+
expect_click_menu_bar(at.menu_item("Duplicate"), "File")
|
157
|
+
subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("duplicate window")
|
158
|
+
|
159
|
+
subject.stub_chain(:clone, :control).and_return(new_instance_control)
|
160
|
+
subject.duplicate.control.should equal(new_instance_control)
|
229
161
|
end
|
230
|
-
end
|
231
162
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
163
|
+
it "Should return a new keynote instance variable after duplication" do
|
164
|
+
subject.should_receive(:duplicate_available?).and_return(true)
|
165
|
+
|
166
|
+
expect_click_menu_bar(at.menu_item("Duplicate"), "File")
|
167
|
+
subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("duplicate window", "New name duplicate window")
|
168
|
+
|
169
|
+
subject.stub_chain(:clone, :control).and_return(new_instance_control)
|
170
|
+
subject.should_receive(:sleep).with(0.4) # Avoiding Mountain Lion crash
|
171
|
+
expect_keystroke!(:return)
|
172
|
+
new_instance_control.should_receive(:set_current_window).with("New name duplicate window")
|
173
|
+
subject.duplicate.control.should equal(new_instance_control)
|
241
174
|
end
|
242
175
|
|
243
|
-
it "Should
|
244
|
-
|
245
|
-
subject.
|
246
|
-
subject.should_not_receive(:set_folder)
|
247
|
-
subject.save("filename")
|
176
|
+
it "Should be able to check whether the save will pop up a dialog or not" do
|
177
|
+
expect_exists?(at.menu_item("Save…").menu(1).menu_bar_item("File").menu_bar(1)).and_return(true)
|
178
|
+
subject.save_pops_up_dialog?.should == true
|
248
179
|
end
|
249
|
-
|
250
|
-
it "Should
|
251
|
-
subject.should_receive(:
|
252
|
-
|
253
|
-
|
254
|
-
subject.
|
180
|
+
|
181
|
+
it "Should be able to retrieve a save dialog by using save as" do
|
182
|
+
subject.should_receive(:save_pops_up_dialog?).and_return(false)
|
183
|
+
expect_keystroke("s", [:command, :shift])
|
184
|
+
expect_wait_until_exists(at.sheet(1))
|
185
|
+
subject.save_dialog
|
255
186
|
end
|
187
|
+
|
188
|
+
it "Should be able to retrieve a save dialog using duplicate and save" do
|
189
|
+
subject.should_receive(:save_pops_up_dialog?).and_return(true)
|
190
|
+
subject.should_receive(:save)
|
191
|
+
expect_wait_until_exists(at.sheet(1))
|
192
|
+
subject.save_dialog
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
256
196
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
197
|
+
it "Should be able to activate" do
|
198
|
+
expect_activate
|
199
|
+
subject.activate
|
200
|
+
end
|
201
|
+
|
202
|
+
it "Should be able to activate and launch. This is done because activate alone in Lion lead to strange behavior" do
|
203
|
+
simulate_mac_version(:lion)
|
204
|
+
expect_running?.and_return(false)
|
205
|
+
expect_launch
|
206
|
+
expect_activate
|
207
|
+
subject.activate
|
208
|
+
end
|
209
|
+
|
210
|
+
it "Should be able to focus" do
|
211
|
+
expect_focus
|
212
|
+
subject.focus
|
213
|
+
end
|
214
|
+
|
215
|
+
context "Copy pasting" do
|
216
|
+
|
217
|
+
it "Should be able to copy" do
|
218
|
+
expect_keystroke("c", :command)
|
219
|
+
subject.copy
|
220
|
+
end
|
221
|
+
|
222
|
+
it "Should be able to paste" do
|
223
|
+
expect_keystroke("v", :command)
|
224
|
+
subject.paste
|
225
|
+
end
|
226
|
+
|
227
|
+
it "Should be able to cut" do
|
228
|
+
expect_keystroke("x", :command)
|
229
|
+
subject.cut
|
262
230
|
end
|
263
231
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
232
|
+
end
|
233
|
+
|
234
|
+
context "Selecting things" do
|
235
|
+
it "Should be able to select all" do
|
236
|
+
expect_keystroke("a", :command)
|
237
|
+
subject.select_all
|
268
238
|
end
|
239
|
+
end
|
240
|
+
|
241
|
+
context "Printing" do
|
269
242
|
|
270
|
-
it "Should be able to
|
271
|
-
|
272
|
-
|
243
|
+
it "Should be able to retrieve a print dialog" do
|
244
|
+
expect_keystroke("p", :command)
|
245
|
+
expect_wait_until_exists(at.sheet(1))
|
246
|
+
subject.print_dialog
|
273
247
|
end
|
248
|
+
end
|
274
249
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
expect_wait_until_not_exists(at.sheet(1).sheet(1))
|
281
|
-
subject.set_folder("path")
|
250
|
+
describe "Application info" do
|
251
|
+
it "Should be able to retrieve an application info object and parse it" do
|
252
|
+
expect_tell('get info for (path to application "ApplicationName")').and_return('name:ApplicationName.app, creation date:date "Sunday, December 21, 2008 PM 06:14:11"}')
|
253
|
+
app_info = subject.get_info
|
254
|
+
app_info.name.should == "ApplicationName.app"
|
282
255
|
end
|
283
256
|
end
|
257
|
+
|
284
258
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'osaka'
|
3
|
+
|
4
|
+
describe "Osaka::TypicalPrintDialog" do
|
5
|
+
|
6
|
+
include(*Osaka::OsakaExpectations)
|
7
|
+
subject { Osaka::TypicalPrintDialog.new("App", at.window("Print")) }
|
8
|
+
|
9
|
+
let(:control) { subject.control = mock("RemoteControl", :name => "App") }
|
10
|
+
|
11
|
+
it "Should be able to save the PDF in a print dialog" do
|
12
|
+
|
13
|
+
control.stub(:base_location).and_return(at.window("Print"))
|
14
|
+
|
15
|
+
save_dialog_mock = mock("Generic Save Dialog")
|
16
|
+
|
17
|
+
expect_click!(at.menu_button("PDF"))
|
18
|
+
expect_wait_until_exists!(at.menu(1).menu_button("PDF"))
|
19
|
+
|
20
|
+
expect_click!(at.menu_item(2).menu(1).menu_button("PDF"))
|
21
|
+
expect_wait_until_exists!(at.window("Save"), at.sheet(1).window("Print")).and_return(at.window("Save"))
|
22
|
+
|
23
|
+
subject.should_receive(:create_save_dialog).with("App", at.window("Save")).and_return(save_dialog_mock)
|
24
|
+
save_dialog_mock.should_receive(:save).with("filename")
|
25
|
+
|
26
|
+
expect_until_not_exists!(at.window("Print"))
|
27
|
+
expect_exists?(at.checkbox(1)).and_return(true)
|
28
|
+
expect_click!(at.checkbox(1))
|
29
|
+
|
30
|
+
subject.save_as_pdf("filename")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'osaka'
|
3
|
+
|
4
|
+
describe "Osaka::TypicalSaveDialog" do
|
5
|
+
|
6
|
+
include(*Osaka::OsakaExpectations)
|
7
|
+
subject { Osaka::TypicalSaveDialog.new("Application", at.sheet(1))}
|
8
|
+
let(:control) { subject.control = mock("RemoteControl", :base_location => at.sheet(1)) }
|
9
|
+
|
10
|
+
it "Should set the filename in the test field" do
|
11
|
+
subject.should_receive(:set_filename).with("filename")
|
12
|
+
subject.should_receive(:click_save)
|
13
|
+
subject.should_not_receive(:set_folder)
|
14
|
+
subject.save("filename")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "Should pick only the base filename when a path is given" do
|
18
|
+
subject.should_receive(:set_filename).with("filename")
|
19
|
+
subject.should_receive(:set_folder)
|
20
|
+
subject.should_receive(:click_save)
|
21
|
+
subject.save("/path/filename")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "Should set the path when a full path is given" do
|
25
|
+
control.as_null_object
|
26
|
+
subject.should_receive(:set_filename)
|
27
|
+
subject.should_receive(:set_folder).with("/path/second")
|
28
|
+
subject.save("/path/second/name")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "Should be able to click save" do
|
32
|
+
expect_click(at.button("Save"))
|
33
|
+
expect_wait_until_not_exists(at.sheet(1))
|
34
|
+
subject.click_save
|
35
|
+
end
|
36
|
+
|
37
|
+
it "Should be able to set the filename" do
|
38
|
+
control.should_receive(:set).with('value', at.text_field(1), "filename")
|
39
|
+
subject.set_filename("filename")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "Should be able to set the path" do
|
43
|
+
expect_keystroke("g", [ :command, :shift ])
|
44
|
+
expect_wait_until_exists(at.sheet(1))
|
45
|
+
expect_set("value", at.text_field(1).sheet(1), "path")
|
46
|
+
expect_click(at.button("Go").sheet(1))
|
47
|
+
expect_wait_until_not_exists(at.sheet(1))
|
48
|
+
subject.set_folder("path")
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: osaka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.4.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bas Vodde
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-21 00:00:00 +08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -47,21 +47,22 @@ files:
|
|
47
47
|
- README.rdoc
|
48
48
|
- Rakefile
|
49
49
|
- lib/osaka.rb
|
50
|
-
- lib/osaka/applicationwrapper.rb
|
51
|
-
- lib/osaka/applicationwrapperexpectations.rb
|
52
50
|
- lib/osaka/calculator.rb
|
53
51
|
- lib/osaka/keynote.rb
|
54
52
|
- lib/osaka/keynoteflow.rb
|
55
53
|
- lib/osaka/location.rb
|
56
54
|
- lib/osaka/mailmergeflow.rb
|
57
55
|
- lib/osaka/numbers.rb
|
56
|
+
- lib/osaka/osakaexpectations.rb
|
58
57
|
- lib/osaka/pages.rb
|
58
|
+
- lib/osaka/remotecontrol.rb
|
59
59
|
- lib/osaka/scriptrunner.rb
|
60
60
|
- lib/osaka/textedit.rb
|
61
61
|
- lib/osaka/typicalapplication.rb
|
62
|
+
- lib/osaka/typicalprintdialog.rb
|
63
|
+
- lib/osaka/typicalsavedialog.rb
|
62
64
|
- lib/osaka/version.rb
|
63
65
|
- osaka.gemfile
|
64
|
-
- spec/applicationwrapper_spec.rb
|
65
66
|
- spec/assets/01_first_slides.key
|
66
67
|
- spec/assets/02_second_slides.key
|
67
68
|
- spec/assets/03_third_slides.key
|
@@ -77,10 +78,14 @@ files:
|
|
77
78
|
- spec/location_spec.rb
|
78
79
|
- spec/mailmergeflow_spec.rb
|
79
80
|
- spec/numbers_spec.rb
|
81
|
+
- spec/osakaexpectations_spec.rb
|
80
82
|
- spec/pages_spec.rb
|
83
|
+
- spec/remotecontrol_spec.rb
|
81
84
|
- spec/scriptrunner_spec.rb
|
82
85
|
- spec/textedit_spec.rb
|
83
86
|
- spec/typicalapplication_spec.rb
|
87
|
+
- spec/typicalprintdialog_spec.rb
|
88
|
+
- spec/typicalsavedialog_spec.rb
|
84
89
|
has_rdoc: true
|
85
90
|
homepage: https://github.com/basvodde/osaka
|
86
91
|
licenses: []
|