minitest-macruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +1 -0
- data/History.txt +6 -0
- data/Manifest.txt +5 -0
- data/README.txt +118 -0
- data/Rakefile +18 -0
- data/lib/minitest/macruby.rb +60 -0
- metadata +172 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
W-���&r���V��}��b��6�ȅ�����#i���Y�"�l0�;h+F�N���˳x[��V"5��(^�L�J�)}�\u�ϋ�q�PS�S�6tq'(���侃��q��!� P�(�!䓾�;F~hPԂ��������5�*L�e��)]�>���-�k��C:�{+K�%}�)Q5�/V�o�p�}-Ǜ��?�|y�O�q"�l�BfկP�<�=�v
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
= minitest-macruby
|
2
|
+
|
3
|
+
* http://rubyforge.org/projects/bfts
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
minitest-macruby provides extensions to minitest for macruby UI
|
8
|
+
testing. It provides a framework to test GUI apps in a live instance.
|
9
|
+
Documentation and examples are light at the moment as I've just thrown
|
10
|
+
this together. Suggestions for extensions are very welcome!
|
11
|
+
|
12
|
+
Currently it provides the following methods in minitest's assertions:
|
13
|
+
|
14
|
+
* self.run_macruby_tests
|
15
|
+
* find_ui_menu(*path)
|
16
|
+
* find_ui_menu_items menu
|
17
|
+
* assert_ui_menu menu, *items
|
18
|
+
* find_ui_menu_item(*path)
|
19
|
+
* assert_ui_action obj, target, action, key = nil
|
20
|
+
* assert_ui_binding item, binding_name, target, path
|
21
|
+
|
22
|
+
== My Current UI Testing Setup
|
23
|
+
|
24
|
+
Here is my current macruby UI testing setup:
|
25
|
+
|
26
|
+
=== Rakefile:
|
27
|
+
|
28
|
+
* Has an isolate setup to pull down all my testing gems.
|
29
|
+
* task build - runs xcodebuild to build a debug app
|
30
|
+
* task link - runs a build and then hard links source files to build files
|
31
|
+
|
32
|
+
=== ~/.emacs.el:
|
33
|
+
|
34
|
+
* sets 'backup-by-copying-when-linked to t - allowing work on
|
35
|
+
hardlinked files to go unimpeded.
|
36
|
+
|
37
|
+
=== .autotest:
|
38
|
+
|
39
|
+
* Sets ENV['RUBY'] to macruby.
|
40
|
+
* Sets ENV['MACRUBY_TESTING'] to 1.
|
41
|
+
* Sets ENV['GEM_HOME'] and ENV['GEM_PATH'] with expanded paths to pick
|
42
|
+
up isolated gems during test runs.
|
43
|
+
* initialize hook sets the test framework to minitest and runs the
|
44
|
+
link rake task.
|
45
|
+
* Overrides Autotest#make_test_cmd to execute the binary directly.
|
46
|
+
|
47
|
+
=== lib/app_controller.rb:
|
48
|
+
|
49
|
+
* sets $TESTING = ENV['MACRUBY_TESTING']
|
50
|
+
* applicationDidFinishLaunching requires minitest/macruby if $TESTING
|
51
|
+
|
52
|
+
=== rb_main.rb:
|
53
|
+
|
54
|
+
* needed to be tweaked to skip loading test files.
|
55
|
+
|
56
|
+
=== Walkthrough:
|
57
|
+
|
58
|
+
So, when I fire up autotest it will build the application and then
|
59
|
+
hardlink all the original source files into the build. This allows
|
60
|
+
autotest to scan the lib and test dirs but invoking the application
|
61
|
+
will pick up all my changes without having to rebuild. This greatly
|
62
|
+
speeds up development.
|
63
|
+
|
64
|
+
When autotest runs the application directly, it does so with
|
65
|
+
MACRUBY_TESTING set in the environment. The application sees this and
|
66
|
+
sets $TESTING to true and once the app is done launching, it loads
|
67
|
+
minitest/macruby. That in turn loads up all the test files in the
|
68
|
+
build dir and then runs the tests. Once the tests are run, it exits
|
69
|
+
with the appropriate exit code depending on test results.
|
70
|
+
|
71
|
+
== FEATURES/PROBLEMS:
|
72
|
+
|
73
|
+
* Provides extensions to your test cases to help test OSX GUI apps.
|
74
|
+
* Still needs spit and polish.
|
75
|
+
|
76
|
+
== SYNOPSIS:
|
77
|
+
|
78
|
+
new, open, _, close, save = find_ui_menu_items "File"
|
79
|
+
|
80
|
+
assert_ui_action new, delegate, "new_document:", "n"
|
81
|
+
assert_ui_action open, delegate, "open_document:", "o"
|
82
|
+
assert_ui_action close, delegate, "close_document:", "w"
|
83
|
+
|
84
|
+
assert_ui_binding close, :enabled, delegate, has_window
|
85
|
+
|
86
|
+
== REQUIREMENTS:
|
87
|
+
|
88
|
+
* minitest
|
89
|
+
* macruby
|
90
|
+
|
91
|
+
== INSTALL:
|
92
|
+
|
93
|
+
* sudo gem install minitest-macruby
|
94
|
+
|
95
|
+
== LICENSE:
|
96
|
+
|
97
|
+
(The MIT License)
|
98
|
+
|
99
|
+
Copyright (c) Ryan Davis, seattle.rb
|
100
|
+
|
101
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
102
|
+
a copy of this software and associated documentation files (the
|
103
|
+
'Software'), to deal in the Software without restriction, including
|
104
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
105
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
106
|
+
permit persons to whom the Software is furnished to do so, subject to
|
107
|
+
the following conditions:
|
108
|
+
|
109
|
+
The above copyright notice and this permission notice shall be
|
110
|
+
included in all copies or substantial portions of the Software.
|
111
|
+
|
112
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
113
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
114
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
115
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
116
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
117
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
118
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
|
6
|
+
Hoe.plugin :seattlerb
|
7
|
+
|
8
|
+
Hoe.spec 'minitest-macruby' do
|
9
|
+
self.version = '1.0.0' # HACK
|
10
|
+
|
11
|
+
developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
|
12
|
+
|
13
|
+
self.rubyforge_name = 'bfts'
|
14
|
+
|
15
|
+
extra_deps << ['minitest', '~> 1.7']
|
16
|
+
end
|
17
|
+
|
18
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
|
3
|
+
class MiniTest::Unit
|
4
|
+
def self.run_macruby_tests
|
5
|
+
dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
|
6
|
+
Dir.chdir dir_path do
|
7
|
+
Dir["**/test_*.rb"].each do |path|
|
8
|
+
require path
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
result = MiniTest::Unit.new.run(ARGV)
|
13
|
+
|
14
|
+
exit!(result && result > 0 ? 1 : 0)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module MiniTest::Assertions
|
19
|
+
def find_ui_menu(*path)
|
20
|
+
app = NSApplication.sharedApplication
|
21
|
+
menu = path.inject(app.mainMenu) { |m, n| m.itemWithTitle(n).submenu }
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_ui_menu_items menu
|
25
|
+
menu = find_ui_menu menu
|
26
|
+
|
27
|
+
menu.itemArray
|
28
|
+
end
|
29
|
+
|
30
|
+
def assert_ui_menu menu, *items
|
31
|
+
item_titles = find_ui_menu_items(menu).map { |item| item.title }
|
32
|
+
|
33
|
+
assert_equal items, item_titles
|
34
|
+
end
|
35
|
+
|
36
|
+
def find_ui_menu_item(*path)
|
37
|
+
item_name = path.pop
|
38
|
+
find_ui_menu(path).itemWithTitle item_name
|
39
|
+
end
|
40
|
+
|
41
|
+
def assert_ui_action obj, target, action, key = nil
|
42
|
+
refute_nil obj, action
|
43
|
+
assert_equal target, obj.target
|
44
|
+
assert_equal action.to_sym, obj.action
|
45
|
+
assert_equal key, obj.keyEquivalent if key
|
46
|
+
end
|
47
|
+
|
48
|
+
def assert_ui_binding item, binding_name, target, path
|
49
|
+
refute_nil item
|
50
|
+
refute_nil target
|
51
|
+
binding = item.infoForBinding binding_name.to_s
|
52
|
+
refute_nil binding
|
53
|
+
assert_equal path, binding["NSObservedKeyPath"]
|
54
|
+
assert_equal target, binding["NSObservedObject"]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
if $0 != __FILE__ then
|
59
|
+
MiniTest::Unit.run_macruby_tests
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-macruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Davis
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
20
|
+
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
21
|
+
GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
|
22
|
+
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
23
|
+
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
24
|
+
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
25
|
+
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
26
|
+
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
27
|
+
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
28
|
+
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
29
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
30
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
31
|
+
AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
|
32
|
+
vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
|
33
|
+
w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
|
34
|
+
l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
|
35
|
+
n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
|
36
|
+
FBHgymkyj/AOSqKRIpXPhjC6
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
|
39
|
+
date: 2010-07-15 00:00:00 -07:00
|
40
|
+
default_executable:
|
41
|
+
dependencies:
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: minitest
|
44
|
+
prerelease: false
|
45
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ~>
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 1
|
51
|
+
segments:
|
52
|
+
- 1
|
53
|
+
- 7
|
54
|
+
version: "1.7"
|
55
|
+
type: :runtime
|
56
|
+
version_requirements: *id001
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rubyforge
|
59
|
+
prerelease: false
|
60
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 7
|
66
|
+
segments:
|
67
|
+
- 2
|
68
|
+
- 0
|
69
|
+
- 4
|
70
|
+
version: 2.0.4
|
71
|
+
type: :development
|
72
|
+
version_requirements: *id002
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: minitest
|
75
|
+
prerelease: false
|
76
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 15
|
82
|
+
segments:
|
83
|
+
- 1
|
84
|
+
- 6
|
85
|
+
- 0
|
86
|
+
version: 1.6.0
|
87
|
+
type: :development
|
88
|
+
version_requirements: *id003
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: hoe
|
91
|
+
prerelease: false
|
92
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 21
|
98
|
+
segments:
|
99
|
+
- 2
|
100
|
+
- 6
|
101
|
+
- 1
|
102
|
+
version: 2.6.1
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id004
|
105
|
+
description: |-
|
106
|
+
minitest-macruby provides extensions to minitest for macruby UI
|
107
|
+
testing. It provides a framework to test GUI apps in a live instance.
|
108
|
+
Documentation and examples are light at the moment as I've just thrown
|
109
|
+
this together. Suggestions for extensions are very welcome!
|
110
|
+
|
111
|
+
Currently it provides the following methods in minitest's assertions:
|
112
|
+
|
113
|
+
* self.run_macruby_tests
|
114
|
+
* find_ui_menu(*path)
|
115
|
+
* find_ui_menu_items menu
|
116
|
+
* assert_ui_menu menu, *items
|
117
|
+
* find_ui_menu_item(*path)
|
118
|
+
* assert_ui_action obj, target, action, key = nil
|
119
|
+
* assert_ui_binding item, binding_name, target, path
|
120
|
+
email:
|
121
|
+
- ryand-ruby@zenspider.com
|
122
|
+
executables: []
|
123
|
+
|
124
|
+
extensions: []
|
125
|
+
|
126
|
+
extra_rdoc_files:
|
127
|
+
- History.txt
|
128
|
+
- Manifest.txt
|
129
|
+
- README.txt
|
130
|
+
files:
|
131
|
+
- History.txt
|
132
|
+
- Manifest.txt
|
133
|
+
- README.txt
|
134
|
+
- Rakefile
|
135
|
+
- lib/minitest/macruby.rb
|
136
|
+
has_rdoc: true
|
137
|
+
homepage: http://rubyforge.org/projects/bfts
|
138
|
+
licenses: []
|
139
|
+
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options:
|
142
|
+
- --main
|
143
|
+
- README.txt
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
hash: 3
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
version: "0"
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
hash: 3
|
161
|
+
segments:
|
162
|
+
- 0
|
163
|
+
version: "0"
|
164
|
+
requirements: []
|
165
|
+
|
166
|
+
rubyforge_project: bfts
|
167
|
+
rubygems_version: 1.3.7
|
168
|
+
signing_key:
|
169
|
+
specification_version: 3
|
170
|
+
summary: minitest-macruby provides extensions to minitest for macruby UI testing
|
171
|
+
test_files: []
|
172
|
+
|
metadata.gz.sig
ADDED
Binary file
|