decoy 0.0.2

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.swp
2
+ *.swo
3
+ *.orig
4
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
data/.rvmrc ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.2-p290@phony"
8
+
9
+ #
10
+ # Uncomment following line if you want options to be set only for given project.
11
+ #
12
+ # PROJECT_JRUBY_OPTS=( --1.9 )
13
+
14
+ #
15
+ # First we attempt to load the desired environment directly from the environment
16
+ # file. This is very fast and efficient compared to running through the entire
17
+ # CLI and selector. If you want feedback on which environment was used then
18
+ # insert the word 'use' after --create as this triggers verbose mode.
19
+ #
20
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
21
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
22
+ then
23
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
24
+
25
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
26
+ then
27
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
28
+ fi
29
+ else
30
+ # If the environment file has not yet been created, use the RVM CLI to select.
31
+ if ! rvm --create use "$environment_id"
32
+ then
33
+ echo "Failed to create RVM environment '${environment_id}'."
34
+ exit 1
35
+ fi
36
+ fi
37
+
38
+ #
39
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
40
+ # it be automatically loaded. Uncomment the following and adjust the filename if
41
+ # necessary.
42
+ #
43
+ # filename=".gems"
44
+ # if [[ -s "$filename" ]]
45
+ # then
46
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
47
+ # fi
48
+
49
+ # If you use bundler, this might be useful to you:
50
+ # if command -v bundle && [[ -s Gemfile ]]
51
+ # then
52
+ # bundle install
53
+ # fi
54
+
55
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in phony.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ decoy (0.0.1)
5
+ rb-appscript
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ activesupport (3.1.1)
11
+ multi_json (~> 1.0)
12
+ archive-tar-minitar (0.5.2)
13
+ columnize (0.3.4)
14
+ diff-lcs (1.1.3)
15
+ factory_girl (2.2.0)
16
+ activesupport
17
+ guard (0.8.8)
18
+ thor (~> 0.14.6)
19
+ guard-bundler (0.1.3)
20
+ bundler (>= 1.0.0)
21
+ guard (>= 0.2.2)
22
+ guard-rspec (0.5.2)
23
+ guard (>= 0.8.4)
24
+ linecache19 (0.5.12)
25
+ ruby_core_source (>= 0.1.4)
26
+ looksee (1.0.3)
27
+ multi_json (1.0.3)
28
+ rb-appscript (0.6.1)
29
+ rspec (2.7.0)
30
+ rspec-core (~> 2.7.0)
31
+ rspec-expectations (~> 2.7.0)
32
+ rspec-mocks (~> 2.7.0)
33
+ rspec-core (2.7.1)
34
+ rspec-expectations (2.7.0)
35
+ diff-lcs (~> 1.1.2)
36
+ rspec-mocks (2.7.0)
37
+ ruby-debug-base19 (0.11.25)
38
+ columnize (>= 0.3.1)
39
+ linecache19 (>= 0.5.11)
40
+ ruby_core_source (>= 0.1.4)
41
+ ruby-debug19 (0.11.6)
42
+ columnize (>= 0.3.1)
43
+ linecache19 (>= 0.5.11)
44
+ ruby-debug-base19 (>= 0.11.19)
45
+ ruby_core_source (0.1.5)
46
+ archive-tar-minitar (>= 0.5.2)
47
+ thor (0.14.6)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ decoy!
54
+ factory_girl
55
+ guard-bundler
56
+ guard-rspec
57
+ looksee
58
+ rspec
59
+ ruby-debug19
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+
2
+ guard 'rspec', :version => 2, :cli => '--colour --format progress' do
3
+ watch(%r{^spec/.+_spec\.rb$})
4
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+
7
+ watch(%r{^spec/.+_spec\.rb$})
8
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
10
+ watch('spec/helper.rb') { "spec" }
11
+ end
data/README.md ADDED
@@ -0,0 +1,463 @@
1
+ # Phony
2
+
3
+ Ruby DSL for scripting FakeApp. [http://fakeapp.com/](http://fakeapp.com/)
4
+
5
+ ## Installation
6
+
7
+ gem install phony
8
+
9
+ ## Dependencies
10
+
11
+
12
+ * rb-appscript
13
+
14
+
15
+ ##DSL
16
+
17
+ ```ruby
18
+
19
+ include Phony::Dsl
20
+
21
+ workflow do
22
+ load_url 'http://google.com'
23
+ set_value_of_element :with_name => 'q', :to => 'kittens'
24
+ click_element :with_name => 'btnG'
25
+ assert :HTTP_status_code_equals => 200
26
+ quit_app
27
+ end
28
+ ```
29
+
30
+ ##API
31
+
32
+ **activate**
33
+
34
+
35
+
36
+ ___
37
+
38
+ **assert**
39
+
40
+ * HTTP_status_code_equals
41
+ * HTTP_status_code_is_not_equal
42
+ * JavaScript_evaluates_true
43
+ * XPath_evaluates_true
44
+ * does_not_have_JavaScript_dialog_with_text
45
+ * has_JavaScript_dialog_with_text
46
+ * in
47
+ * page_contains_text
48
+ * page_does_not_contain_text
49
+ * page_does_not_have_element_for_XPath
50
+ * page_does_not_have_element_with_id
51
+ * page_does_not_have_element_with_name
52
+ * page_has_element_for_XPath
53
+ * page_has_element_with_id
54
+ * page_has_element_with_name
55
+ * page_title_equals
56
+ * page_title_is_not_equal
57
+
58
+
59
+ ___
60
+
61
+ **capture_web_page**
62
+
63
+ * as
64
+ * in
65
+ * saving_in
66
+
67
+
68
+ ___
69
+
70
+ **click_element**
71
+
72
+ * for_CSS_selector
73
+ * for_JavaScript
74
+ * for_XPath
75
+ * in
76
+ * with_id
77
+ * with_name
78
+ * with_text
79
+
80
+
81
+ ___
82
+
83
+ **click_link**
84
+
85
+ * for_CSS_selector
86
+ * for_JavaScript
87
+ * for_XPath
88
+ * in
89
+ * opening_in_background
90
+ * opening_in_new_tab
91
+ * with_id
92
+ * with_name
93
+ * with_text
94
+
95
+
96
+ ___
97
+
98
+ **close**
99
+
100
+ * saving
101
+ * saving_in
102
+
103
+
104
+ ___
105
+
106
+ **count**
107
+
108
+
109
+
110
+ ___
111
+
112
+ **delete**
113
+
114
+
115
+
116
+ ___
117
+
118
+ **dismiss_javascript_dialog**
119
+
120
+ * in
121
+ * with_button
122
+
123
+
124
+ ___
125
+
126
+ **dispatch_keyboard_event**
127
+
128
+ * charCode
129
+ * command_key_pressed
130
+ * control_key_pressed
131
+ * in
132
+ * keyCode
133
+ * option_key_pressed
134
+ * shift_key_pressed
135
+ * to_element_for_CSS_selector
136
+ * to_element_for_JavaScript
137
+ * to_element_for_XPath
138
+ * to_element_with_id
139
+ * to_element_with_name
140
+ * with_type
141
+
142
+
143
+ ___
144
+
145
+ **dispatch_mouse_event**
146
+
147
+ * button
148
+ * click_count
149
+ * command_key_pressed
150
+ * control_key_pressed
151
+ * in
152
+ * option_key_pressed
153
+ * related_target_for_CSS_selector
154
+ * related_target_for_JavaScript
155
+ * related_target_for_XPath
156
+ * related_target_with_id
157
+ * related_target_with_name
158
+ * shift_key_pressed
159
+ * to_element_for_CSS_selector
160
+ * to_element_for_JavaScript
161
+ * to_element_for_XPath
162
+ * to_element_with_id
163
+ * to_element_with_name
164
+ * with_type
165
+
166
+
167
+ ___
168
+
169
+ **do_javascript**
170
+
171
+ * in
172
+
173
+
174
+ ___
175
+
176
+ **duplicate**
177
+
178
+ * to
179
+ * with_properties
180
+
181
+
182
+ ___
183
+
184
+ **empty_cache**
185
+
186
+
187
+
188
+ ___
189
+
190
+ **exists**
191
+
192
+
193
+
194
+ ___
195
+
196
+ **focus_element**
197
+
198
+ * for_CSS_selector
199
+ * for_JavaScript
200
+ * for_XPath
201
+ * in
202
+ * in_form_for_CSS_selector
203
+ * in_form_for_JavaScript
204
+ * in_form_for_XPath
205
+ * in_form_with_id
206
+ * in_form_with_name
207
+ * to
208
+ * with_id
209
+ * with_name
210
+
211
+
212
+ ___
213
+
214
+ **get**
215
+
216
+
217
+
218
+ ___
219
+
220
+ **go_back**
221
+
222
+
223
+
224
+ ___
225
+
226
+ **go_forward**
227
+
228
+
229
+
230
+ ___
231
+
232
+ **go_home**
233
+
234
+
235
+
236
+ ___
237
+
238
+ **launch**
239
+
240
+
241
+
242
+ ___
243
+
244
+ **load_url**
245
+
246
+ * in
247
+
248
+
249
+ ___
250
+
251
+ **make**
252
+
253
+ * at
254
+ * new
255
+ * with_data
256
+ * with_properties
257
+
258
+
259
+ ___
260
+
261
+ **move**
262
+
263
+ * to
264
+
265
+
266
+ ___
267
+
268
+ **open**
269
+
270
+
271
+
272
+ ___
273
+
274
+ **open_location**
275
+
276
+ * window
277
+
278
+
279
+ ___
280
+
281
+ **print**
282
+
283
+ * print_dialog
284
+ * with_properties
285
+
286
+
287
+ ___
288
+
289
+ **quit**
290
+
291
+ * saving
292
+
293
+
294
+ ___
295
+
296
+ **reload**
297
+
298
+
299
+
300
+ ___
301
+
302
+ **reopen**
303
+
304
+
305
+
306
+ ___
307
+
308
+ **run**
309
+
310
+
311
+
312
+ ___
313
+
314
+ **run_workflow**
315
+
316
+ * with_variables
317
+
318
+
319
+ ___
320
+
321
+ **save**
322
+
323
+ * in
324
+
325
+
326
+ ___
327
+
328
+ **send_email_with**
329
+
330
+ * body
331
+ * from
332
+ * password
333
+ * port
334
+ * smtp_server
335
+ * subject
336
+ * to
337
+ * username
338
+
339
+
340
+ ___
341
+
342
+ **set**
343
+
344
+ * to
345
+
346
+
347
+ ___
348
+
349
+ **set_contents_of_clipboard**
350
+
351
+ * in
352
+ * to_value_of_JavaScript
353
+ * to_value_of_element_for_CSS_selector
354
+ * to_value_of_element_for_XPath
355
+ * to_value_of_element_with_id
356
+ * to_value_of_element_with_name
357
+
358
+
359
+ ___
360
+
361
+ **set_form_values**
362
+
363
+ * for_CSS_selector
364
+ * for_JavaScript
365
+ * for_XPath
366
+ * in
367
+ * with_id
368
+ * with_name
369
+ * with_values
370
+
371
+
372
+ ___
373
+
374
+ **set_value_of_element**
375
+
376
+ * for_CSS_selector
377
+ * for_JavaScript
378
+ * for_XPath
379
+ * in
380
+ * in_form_for_CSS_selector
381
+ * in_form_for_JavaScript
382
+ * in_form_for_XPath
383
+ * in_form_with_id
384
+ * in_form_with_name
385
+ * to
386
+ * with_id
387
+ * with_name
388
+
389
+
390
+ ___
391
+
392
+ **set_variable**
393
+
394
+ * in
395
+ * to
396
+ * to_contents_of_Clipboard
397
+ * to_contents_of_file
398
+ * to_value_of_JavaScript
399
+ * to_value_of_XPath
400
+ * to_value_of_element_for_CSS_selector
401
+ * to_value_of_element_for_XPath
402
+ * to_value_of_element_with_id
403
+ * to_value_of_element_with_name
404
+ * with_name
405
+ ___
406
+
407
+ **show_actual_size**
408
+
409
+ ___
410
+
411
+ **stop_loading**
412
+
413
+ ___
414
+
415
+ **stop_workflow**
416
+
417
+ ___
418
+
419
+ **submit_form**
420
+
421
+ * for_CSS_selector
422
+ * for_JavaScript
423
+ * for_XPath
424
+ * in
425
+ * with_id
426
+ * with_name
427
+
428
+
429
+ ___
430
+
431
+ **wait_for_condition**
432
+
433
+ * JavaScript_evaluates_true
434
+ * XPath_evaluates_true
435
+ * does_not_have_JavaScript_dialog_with_text
436
+ * has_JavaScript_dialog_with_text
437
+ * in
438
+ * page_contains_text
439
+ * page_does_not_contain_text
440
+ * page_does_not_have_element_for_XPath
441
+ * page_does_not_have_element_with_id
442
+ * page_does_not_have_element_with_name
443
+ * page_has_element_for_XPath
444
+ * page_has_element_with_id
445
+ * page_has_element_with_name
446
+ * page_title_equals
447
+ * page_title_is_not_equal
448
+ * with_timeout
449
+
450
+
451
+ ___
452
+
453
+ **wait_until_done**
454
+
455
+ * with_timeout
456
+
457
+ ___
458
+
459
+ **zoom_in**
460
+
461
+ ___
462
+
463
+ **zoom_out**
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/decoy ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'decoy'
6
+ require 'irb'
7
+
8
+
9
+
10
+ include Decoy::Dsl::Commands
11
+
12
+ IRB.setup(nil)
13
+ irb = IRB::Irb.new
14
+
15
+ IRB.conf[:MAIN_CONTEXT] = irb.context
16
+
17
+ irb.context.evaluate("require 'irb/completion'", 0)
18
+
19
+ trap("SIGINT") do
20
+ irb.signal_handle
21
+ end
22
+
23
+ catch(:IRB_EXIT) do
24
+ irb.eval_input
25
+ end
data/decoy.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "decoy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "decoy"
7
+ s.version = Decoy::VERSION
8
+ s.authors = ["twoism"]
9
+ s.email = ["signalstatic@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Ruby DSL for FakeApp}
12
+ s.description = %q{Simple Ruby DSL for controlling FakeApp}
13
+
14
+ s.rubyforge_project = "decoy"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency "rspec"
22
+ s.add_development_dependency "guard-rspec"
23
+ s.add_development_dependency "guard-bundler"
24
+ s.add_development_dependency "factory_girl"
25
+ s.add_development_dependency "ruby-debug19"
26
+ s.add_development_dependency "looksee"
27
+ s.add_runtime_dependency "rb-appscript"
28
+ end
data/dsl_test.rb ADDED
@@ -0,0 +1,18 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+ require 'phony'
3
+
4
+ # load_url 'http://google.com'
5
+ # set_value_of_element :with_name => 'q', :to => 'posterous'
6
+ # click_element :with_name => 'btnG'
7
+ # assert :HTTP_status_code_equals => 201
8
+ # quit_app
9
+
10
+ include Phony::Dsl
11
+
12
+ workflow do
13
+ path = '/Users/twoism/dev/robocop/Login.fakeworkflow'
14
+
15
+ open_workflow path
16
+ run_workflow
17
+ wait_until_done
18
+ end
@@ -0,0 +1,198 @@
1
+ module Decoy
2
+ module Commands
3
+ def app
4
+ @app ||= Decoy.app
5
+ end
6
+
7
+ def activate(opts={}) #[]
8
+ app.activate opts
9
+ end
10
+
11
+ def assert(opts={}) #["HTTP_status_code_equals", "HTTP_status_code_is_not_equal", "JavaScript_evaluates_true", "XPath_evaluates_true", "does_not_have_JavaScript_dialog_with_text", "has_JavaScript_dialog_with_text", "in", "page_contains_text", "page_does_not_contain_text", "page_does_not_have_element_for_XPath", "page_does_not_have_element_with_id", "page_does_not_have_element_with_name", "page_has_element_for_XPath", "page_has_element_with_id", "page_has_element_with_name", "page_title_equals", "page_title_is_not_equal"]
12
+ app.assert opts
13
+ rescue Appscript::CommandError => e
14
+ p e.message.split("\n\n").last
15
+ end
16
+
17
+ def capture_web_page(opts={}) #["as", "in", "saving_in"]
18
+ app.capture_web_page opts
19
+ end
20
+
21
+ def click_element(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "with_id", "with_name", "with_text"]
22
+ app.click_element opts
23
+ end
24
+
25
+ def click_link(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "opening_in_background", "opening_in_new_tab", "with_id", "with_name", "with_text"]
26
+ app.click_link opts
27
+ end
28
+
29
+ def close(opts={}) #["saving", "saving_in"]
30
+ app.close opts
31
+ end
32
+
33
+ def count(opts={}) #[]
34
+ app.count opts
35
+ end
36
+
37
+ def delete(opts={}) #[]
38
+ app.delete opts
39
+ end
40
+
41
+ def dismiss_javascript_dialog(opts={}) #["in", "with_button"]
42
+ app.dismiss_JavaScript_dialog opts
43
+ end
44
+
45
+ def dispatch_keyboard_event(opts={}) #["charCode", "command_key_pressed", "control_key_pressed", "in", "keyCode", "option_key_pressed", "shift_key_pressed", "to_element_for_CSS_selector", "to_element_for_JavaScript", "to_element_for_XPath", "to_element_with_id", "to_element_with_name", "with_type"]
46
+ app.dispatch_keyboard_event opts
47
+ end
48
+
49
+ def dispatch_mouse_event(opts={}) #["button", "click_count", "command_key_pressed", "control_key_pressed", "in", "option_key_pressed", "related_target_for_CSS_selector", "related_target_for_JavaScript", "related_target_for_XPath", "related_target_with_id", "related_target_with_name", "shift_key_pressed", "to_element_for_CSS_selector", "to_element_for_JavaScript", "to_element_for_XPath", "to_element_with_id", "to_element_with_name", "with_type"]
50
+ app.dispatch_mouse_event opts
51
+ end
52
+
53
+ def do_javascript(opts={}) #["in"]
54
+ app.do_JavaScript opts
55
+ end
56
+
57
+ def duplicate(opts={}) #["to", "with_properties"]
58
+ app.duplicate opts
59
+ end
60
+
61
+ def empty_cache(opts={}) #[]
62
+ app.empty_cache opts
63
+ end
64
+
65
+ def exists(opts={}) #[]
66
+ app.exists opts
67
+ end
68
+
69
+ def focus_element(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "in_form_for_CSS_selector", "in_form_for_JavaScript", "in_form_for_XPath", "in_form_with_id", "in_form_with_name", "to", "with_id", "with_name"]
70
+ app.focus_element opts
71
+ end
72
+
73
+ def get(opts={}) #[]
74
+ app.get opts
75
+ end
76
+
77
+ def go_back(opts={}) #[]
78
+ app.go_back opts
79
+ end
80
+
81
+ def go_forward(opts={}) #[]
82
+ app.go_forward opts
83
+ end
84
+
85
+ def go_home(opts={}) #[]
86
+ app.go_home opts
87
+ end
88
+
89
+ def launch(opts={}) #[]
90
+ app.launch opts
91
+ end
92
+
93
+ def load_url(opts={}) #["in"]
94
+ app.load_URL opts
95
+ end
96
+
97
+ def make(opts={}) #["at", "new", "with_data", "with_properties"]
98
+ app.make opts
99
+ end
100
+
101
+ def move(opts={}) #["to"]
102
+ app.move opts
103
+ end
104
+
105
+ def open_workflow(path, opts={}) #[]
106
+ app.open path, opts
107
+ end
108
+
109
+ def open_location(opts={}) #["window"]
110
+ app.open_location opts
111
+ end
112
+
113
+ def print_page(opts={}) #["print_dialog", "with_properties"]
114
+ app.print opts
115
+ end
116
+
117
+ def quit_app(opts={}) #["saving"]
118
+ app.quit opts
119
+ end
120
+
121
+ def reload(opts={}) #[]
122
+ app.reload opts
123
+ end
124
+
125
+ def reopen(opts={}) #[]
126
+ app.reopen opts
127
+ end
128
+
129
+ def run(opts={}) #[]
130
+ app.run opts
131
+ end
132
+
133
+ def run_workflow(opts={}) #["with_variables"]
134
+ app.run_workflow app.document, opts
135
+ end
136
+
137
+ def save(opts={}) #["in"]
138
+ app.save opts
139
+ end
140
+
141
+ def send_email_with(opts={}) #["body", "from", "password", "port", "smtp_server", "subject", "to", "username"]
142
+ app.send_email_with opts
143
+ end
144
+
145
+ def set(opts={}) #["to"]
146
+ app.set opts
147
+ end
148
+
149
+ def set_contents_of_clipboard(opts={}) #["in", "to_value_of_JavaScript", "to_value_of_element_for_CSS_selector", "to_value_of_element_for_XPath", "to_value_of_element_with_id", "to_value_of_element_with_name"]
150
+ app.set_contents_of_Clipboard opts
151
+ end
152
+
153
+ def set_form_values(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "with_id", "with_name", "with_values"]
154
+ app.set_form_values opts
155
+ end
156
+
157
+ def set_value_of_element(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "in_form_for_CSS_selector", "in_form_for_JavaScript", "in_form_for_XPath", "in_form_with_id", "in_form_with_name", "to", "with_id", "with_name"]
158
+ app.set_value_of_element opts
159
+ end
160
+
161
+ def set_variable(opts={}) #["in", "to", "to_contents_of_Clipboard", "to_contents_of_file", "to_value_of_JavaScript", "to_value_of_XPath", "to_value_of_element_for_CSS_selector", "to_value_of_element_for_XPath", "to_value_of_element_with_id", "to_value_of_element_with_name", "with_name"]
162
+ app.set_variable opts
163
+ end
164
+
165
+ def show_actual_size(opts={}) #[]
166
+ app.show_actual_size opts
167
+ end
168
+
169
+ def stop_loading(opts={}) #[]
170
+ app.stop_loading opts
171
+ end
172
+
173
+ def stop_workflow(opts={}) #[]
174
+ app.stop_workflow opts
175
+ end
176
+
177
+ def submit_form(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "with_id", "with_name"]
178
+ app.submit_form opts
179
+ end
180
+
181
+ def wait_for_condition(opts={}) #["JavaScript_evaluates_true", "XPath_evaluates_true", "does_not_have_JavaScript_dialog_with_text", "has_JavaScript_dialog_with_text", "in", "page_contains_text", "page_does_not_contain_text", "page_does_not_have_element_for_XPath", "page_does_not_have_element_with_id", "page_does_not_have_element_with_name", "page_has_element_for_XPath", "page_has_element_with_id", "page_has_element_with_name", "page_title_equals", "page_title_is_not_equal", "with_timeout"]
182
+ app.wait_for_condition opts
183
+ end
184
+
185
+ def wait_until_done(opts={}) #["with_timeout"]
186
+ app.wait_until_done app.document, opts
187
+ end
188
+
189
+ def zoom_in(opts={}) #[]
190
+ app.zoom_in opts
191
+ end
192
+
193
+ def zoom_out(opts={}) #[]
194
+ app.zoom_out opts
195
+ end
196
+
197
+ end
198
+ end
data/lib/decoy/dsl.rb ADDED
@@ -0,0 +1,22 @@
1
+ module Decoy
2
+ module Dsl
3
+
4
+ def self.included base
5
+ base.class_eval do
6
+ include Commands
7
+ include InstanceMethods
8
+ end
9
+ end
10
+
11
+ module InstanceMethods
12
+ def workflow &block
13
+ yield
14
+ end
15
+
16
+ def running?
17
+ app.running?
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Decoy
2
+ VERSION = "0.0.2"
3
+ end
data/lib/decoy.rb ADDED
@@ -0,0 +1,15 @@
1
+ require "bundler/setup"
2
+ require 'appscript'
3
+ require "decoy/version"
4
+
5
+ module Decoy
6
+ extend self
7
+
8
+ autoload :Dsl, 'decoy/dsl'
9
+ autoload :Commands, 'decoy/commands'
10
+
11
+ def app
12
+ Appscript.app('Fake')
13
+ end
14
+
15
+ end
Binary file
data/spec/helper.rb ADDED
@@ -0,0 +1,7 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+
3
+ require 'decoy'
4
+
5
+ RSpec.configure do |config|
6
+
7
+ end
@@ -0,0 +1,13 @@
1
+ require 'helper'
2
+
3
+ describe Decoy::Commands do
4
+
5
+ let(:dsl) { Class.new{ include Decoy::Commands }.new }
6
+
7
+ describe "#load_url" do
8
+ before { dsl.app.should_receive(:load_URL).with('http://kittens.com') }
9
+ it { dsl.load_url('http://kittens.com') }
10
+ end
11
+
12
+ end
13
+
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: decoy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - twoism
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-10 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70292480639360 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70292480639360
25
+ - !ruby/object:Gem::Dependency
26
+ name: guard-rspec
27
+ requirement: &70292480638940 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70292480638940
36
+ - !ruby/object:Gem::Dependency
37
+ name: guard-bundler
38
+ requirement: &70292480638520 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70292480638520
47
+ - !ruby/object:Gem::Dependency
48
+ name: factory_girl
49
+ requirement: &70292480638100 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70292480638100
58
+ - !ruby/object:Gem::Dependency
59
+ name: ruby-debug19
60
+ requirement: &70292480637680 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70292480637680
69
+ - !ruby/object:Gem::Dependency
70
+ name: looksee
71
+ requirement: &70292480637260 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70292480637260
80
+ - !ruby/object:Gem::Dependency
81
+ name: rb-appscript
82
+ requirement: &70292480636840 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *70292480636840
91
+ description: Simple Ruby DSL for controlling FakeApp
92
+ email:
93
+ - signalstatic@gmail.com
94
+ executables:
95
+ - decoy
96
+ extensions: []
97
+ extra_rdoc_files: []
98
+ files:
99
+ - .gitignore
100
+ - .rspec
101
+ - .rvmrc
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - Guardfile
105
+ - README.md
106
+ - Rakefile
107
+ - bin/decoy
108
+ - decoy.gemspec
109
+ - dsl_test.rb
110
+ - lib/decoy.rb
111
+ - lib/decoy/commands.rb
112
+ - lib/decoy/dsl.rb
113
+ - lib/decoy/version.rb
114
+ - pkg/decoy-0.0.2.gem
115
+ - spec/helper.rb
116
+ - spec/lib/decoy/dsl_spec.rb
117
+ homepage: ''
118
+ licenses: []
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project: decoy
137
+ rubygems_version: 1.8.6
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: Ruby DSL for FakeApp
141
+ test_files:
142
+ - spec/helper.rb
143
+ - spec/lib/decoy/dsl_spec.rb