gem_suit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.suit +4 -0
- data/CHANGELOG.rdoc +5 -0
- data/Gemfile +3 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +419 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/bin/suit +10 -0
- data/gem_suit.gemspec +26 -0
- data/lib/gem_suit/application/actions.rb +203 -0
- data/lib/gem_suit/application/test.rb +106 -0
- data/lib/gem_suit/application/utils/gemfile.rb +42 -0
- data/lib/gem_suit/application/utils.rb +135 -0
- data/lib/gem_suit/application.rb +42 -0
- data/lib/gem_suit/cli/application/io_buffer.rb +54 -0
- data/lib/gem_suit/cli/application/test_loader.rb +5 -0
- data/lib/gem_suit/cli/application.rb +159 -0
- data/lib/gem_suit/cli/base/shell.rb +41 -0
- data/lib/gem_suit/cli/base/utils.rb +83 -0
- data/lib/gem_suit/cli/base.rb +15 -0
- data/lib/gem_suit/cli/builder/boot +14 -0
- data/lib/gem_suit/cli/builder/generator.rb +154 -0
- data/lib/gem_suit/cli/builder/rails_app.rb +146 -0
- data/lib/gem_suit/cli/builder.rb +143 -0
- data/lib/gem_suit/cli/config/hash.rb +61 -0
- data/lib/gem_suit/cli/config.rb +37 -0
- data/lib/gem_suit/cli.rb +145 -0
- data/lib/gem_suit/integration_test.rb +14 -0
- data/lib/gem_suit/test_help.rb +17 -0
- data/lib/gem_suit/version.rb +9 -0
- data/lib/gem_suit.rb +6 -0
- data/templates/dynamic/CHANGELOG.rdoc +5 -0
- data/templates/dynamic/Gemfile +14 -0
- data/templates/dynamic/MIT-LICENSE +20 -0
- data/templates/dynamic/README.textile +35 -0
- data/templates/dynamic/VERSION +1 -0
- data/templates/dynamic/config/boot.rb +13 -0
- data/templates/dynamic/config/preinitializer.rb +20 -0
- data/templates/dynamic/gitignore +9 -0
- data/templates/dynamic/suit/shared/app/views/application/index.html.erb +16 -0
- data/templates/dynamic/suit/shared/public/stylesheets/app.css +99 -0
- data/templates/dynamic/suit/shared/test/test_helper.rb +37 -0
- data/templates/dynamic/suit/templates/shared/Gemfile +14 -0
- data/templates/dynamic/suit/templates/shared/config/database-mysql.yml +11 -0
- data/templates/dynamic/suit/templates/shared/config/database-sqlite.yml +10 -0
- data/templates/static/suit/shared/app/models/.gitkeep +0 -0
- data/templates/static/suit/shared/app/views/layouts/application.html.erb +11 -0
- data/templates/static/suit/shared/db/schema.rb +2 -0
- data/templates/static/suit/shared/db/seeds.rb +7 -0
- data/templates/static/suit/shared/test/fixtures/.gitkeep +0 -0
- data/templates/static/suit/shared/test/integration/suit/example.rb +40 -0
- data/templates/static/suit/shared/test/suit_application/capybara_extensions.rb +36 -0
- data/templates/static/suit/shared/test/suit_application.rb +27 -0
- data/templates/static/suit/shared/test/unit/.gitkeep +0 -0
- data/templates/static/suit/templates/shared/config/initializers/.gitkeep +0 -0
- data/templates/static/suit/templates/shared/db/schema.rb +2 -0
- metadata +188 -0
data/.gitignore
ADDED
data/.suit
ADDED
data/CHANGELOG.rdoc
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Paul Engel
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,419 @@
|
|
1
|
+
h1. GemSuit
|
2
|
+
|
3
|
+
Test the *entire* usage workflow (including the generators) of your newly generated or existing gem within Rails 2 and 3 and make the gem development mobile.
|
4
|
+
|
5
|
+
As Barney Stinson advises: *"Gem suit up! It's gonna be legend"* ^^
|
6
|
+
|
7
|
+
h2. Introduction
|
8
|
+
|
9
|
+
We Rails developers are experiencing great evolvements at the moment: not only are we migrating from Ruby 1.8 to Ruby 1.9, but we are also migrating from Rails 2.3 to Rails 3. This means that Rails gem writers have to deal with this. Luckily, there is "Rich-Support":https://github.com/archan937/rich_support which provides Rails 2 and 3 compliance to your Rails gem, but you also want to be able to run integration tests within a Rails 2 and 3 environment.
|
10
|
+
|
11
|
+
And so this is where GemSuit kicks in: it provides an extensive test suite to a (newly generated or existing) gem in which you can test the whole gem usage process. From a clean Rails (2 or 3) application, to running your gem generators, to testing your front-end within Firefox with Capybara.
|
12
|
+
|
13
|
+
GemSuit is "TestUnit":http://test-unit.rubyforge.org/, "Shoulda":https://github.com/thoughtbot/shoulda (mainly for contexts), "Capybara":https://github.com/jnicklas/capybara and "Selenium":http://seleniumhq.org/ driven and it also provides you to run the Rails (2 or 3) server and console (for development and testing purposes) very easily!
|
14
|
+
|
15
|
+
h3. So what can I test exactly?
|
16
|
+
|
17
|
+
As already mentioned, GemSuit really aims on testing the entire process of using your gem in a Rails app. A GemSuit integration test can consist of the following steps:
|
18
|
+
|
19
|
+
# Start with a clean Rails (2 or 3) application (as if you just ran @rails new your_rails_app@)
|
20
|
+
# Prep certain files (e.g. initializers) using Thor's template generation capabilities
|
21
|
+
# Run several generators provided by your gem
|
22
|
+
# Load fixtures
|
23
|
+
# Open the Rails app in the browser and run assertions (with Capybara in Firefox)
|
24
|
+
|
25
|
+
And also you can run unit tests (and the other standard tests) within both Rails 2 and 3.
|
26
|
+
|
27
|
+
A real world example of a GemSuit implementation is "Rich-CMS":https://github.com/archan937/rich_cms/tree/edge.
|
28
|
+
|
29
|
+
h2. Quickstart
|
30
|
+
|
31
|
+
Run the following in your terminal:
|
32
|
+
|
33
|
+
<pre>
|
34
|
+
$ gem install gem_suit
|
35
|
+
$ suit tailor your_new_gem
|
36
|
+
$ cd your_new_gem
|
37
|
+
$ suit -v
|
38
|
+
</pre>
|
39
|
+
|
40
|
+
*Note*: Make sure you have "Firefox":http://www.getfirefox.com installed.
|
41
|
+
|
42
|
+
h2. Installation
|
43
|
+
|
44
|
+
Run the following command in your console:
|
45
|
+
|
46
|
+
<pre>
|
47
|
+
gem install gem_suit
|
48
|
+
</pre>
|
49
|
+
|
50
|
+
h2. Provide your gem with GemSuit
|
51
|
+
|
52
|
+
h3. Generating a new gem
|
53
|
+
|
54
|
+
Run the following command to create a gem with Bundler and the GemSuit test suite:
|
55
|
+
|
56
|
+
<pre>
|
57
|
+
suit tailor your_gem_name
|
58
|
+
</pre>
|
59
|
+
|
60
|
+
*Note*: What @suit tailor@ actually does, is: @bundle gem your_gem_name@, @cd your_gem_name@, @suit up@ and finally @suit fit@.
|
61
|
+
|
62
|
+
h3. For an already created gem
|
63
|
+
|
64
|
+
Run the following command within your gem directory (e.g. in @Gems/rich_cms@ for the gem Rich-CMS)
|
65
|
+
|
66
|
+
<pre>
|
67
|
+
suit up
|
68
|
+
</pre>
|
69
|
+
|
70
|
+
Your gem is now provided with GemSuit ^^
|
71
|
+
|
72
|
+
<img src="http://codehero.es/images/barney-suit_up_small.jpg"/>
|
73
|
+
|
74
|
+
h2. Great. But now what?
|
75
|
+
|
76
|
+
h3. Developing your gem
|
77
|
+
|
78
|
+
After you have made your gem a little bit more legend, you can start developing your gem with the Rails 2 and 3 dummy applications provided (within @suit/rails-{2,3}/dummy@). This makes the gem development very mobile as you can commit them (with the Sqlite databases) in your Git repository! Just run the following to start the Rails 3 server:
|
79
|
+
|
80
|
+
<pre>
|
81
|
+
suit s
|
82
|
+
</pre>
|
83
|
+
|
84
|
+
Run the Rails 2 server on port @3001@ as follows:
|
85
|
+
|
86
|
+
<pre>
|
87
|
+
suit s -r2 -p3001
|
88
|
+
</pre>
|
89
|
+
|
90
|
+
You can also start the Rails console (Rails 3 at default) of the dummy applications (use @-r2@ to use the Rails 2 console):
|
91
|
+
|
92
|
+
<pre>
|
93
|
+
suit c
|
94
|
+
</pre>
|
95
|
+
|
96
|
+
h3. Making your gem development mobile
|
97
|
+
|
98
|
+
It is possible that you will have to develop your gem on another computer or that there are multiple developers (and thus coping with different computers). As mentioned in the previous section, everything is added to the Git repository. The only pitfall can be that the computer is not prepped for the gem development. Think of not having all the gem dependecies installed.
|
99
|
+
|
100
|
+
Just check out the gem Git repository and "fit the GemSuit" with @suit fit@. With "Rich-CMS":https://github.com/archan937/rich_cms/tree/edge as example, run the following:
|
101
|
+
|
102
|
+
<pre>
|
103
|
+
$ git clone https://github.com/archan937/rich_cms.git
|
104
|
+
$ cd rich_cms
|
105
|
+
$ suit fit -v
|
106
|
+
</pre>
|
107
|
+
|
108
|
+
h2. Testing with GemSuit
|
109
|
+
|
110
|
+
h3. Running the GemSuit integration tests (with Capybara and Selenium)
|
111
|
+
|
112
|
+
To run the integration tests just run the following:
|
113
|
+
|
114
|
+
<pre>
|
115
|
+
suit -v
|
116
|
+
</pre>
|
117
|
+
|
118
|
+
*Note*: The @-v@ option outputs a summary of the test results. You can also run the tests with just @suit@ for no additional output or @suit -w@ for very verbose output.
|
119
|
+
|
120
|
+
h3. Restoring the Rails dummy applications
|
121
|
+
|
122
|
+
GemSuit uses the dummy applications for the integration tests by stashing and restoring its source files. When a test fails, the state of the Rails application directory stays as it is during the test. To reset the dummy application, just run the following command:
|
123
|
+
|
124
|
+
<pre>
|
125
|
+
suit restore
|
126
|
+
</pre>
|
127
|
+
|
128
|
+
h3. Running unit (and the common) tests with Rails 2 and 3
|
129
|
+
|
130
|
+
The standard Rails provided tests can be run with:
|
131
|
+
|
132
|
+
<pre>
|
133
|
+
suit test unit
|
134
|
+
</pre>
|
135
|
+
|
136
|
+
To only run tests in Rails 3, use the following:
|
137
|
+
|
138
|
+
<pre>
|
139
|
+
suit test unit -r3
|
140
|
+
</pre>
|
141
|
+
|
142
|
+
h2. Writing GemSuit integration tests
|
143
|
+
|
144
|
+
h3. A real world example
|
145
|
+
|
146
|
+
Please explore "https://github.com/archan937/rich_cms/tree/edge/suit":https://github.com/archan937/rich_cms/tree/edge/suit for examples of the GemSuit integration test possibilities.
|
147
|
+
|
148
|
+
h3. The provided ExampleTest
|
149
|
+
|
150
|
+
After running @suit up@ (or @suit tailor@ when creating a new gem), you will have @suit/shared/test/integration/suit/example.rb@ at your disposal. As you might have guessed, this is an example of a GemSuit integration test. You can see it in action by running:
|
151
|
+
|
152
|
+
<pre>
|
153
|
+
suit -v
|
154
|
+
</pre>
|
155
|
+
|
156
|
+
h3. Essential sources and directories
|
157
|
+
|
158
|
+
Certain sources (and directories) are essential when writing a GemSuit integration test:
|
159
|
+
|
160
|
+
h4. suit/shared/test/integration/suit/*.rb
|
161
|
+
|
162
|
+
This directory contains all the GemSuit integration tests.
|
163
|
+
At default it is provided with @example.rb@, "an example":https://github.com/archan937/rich_cms/tree/edge/suit/shared/test/integration/suit
|
164
|
+
|
165
|
+
h4. suit/shared/test/suit_application/==**/*.*==
|
166
|
+
|
167
|
+
Source files within this directory will be required when running tests.
|
168
|
+
You are supposed to put additional @lib@ sources for testing purposes in here: "an example":https://github.com/archan937/rich_cms/blob/edge/suit/shared/test/suit_application/rich/i18n_forgery.rb
|
169
|
+
|
170
|
+
h4. suit/shared/test/suit_application/capybara_extensions.rb
|
171
|
+
|
172
|
+
This source file contains helper methods when running the GemSuit integration test with Capybara.
|
173
|
+
Think of logging in, logging out and filling in a form: "an example":https://github.com/archan937/rich_cms/blob/edge/suit/shared/test/suit_application/capybara_extensions.rb
|
174
|
+
|
175
|
+
h4. suit/shared/test/suit_application.rb
|
176
|
+
|
177
|
+
The role of @SuitApplication@ is to prepare and restore the dummy application when running a GemSuit integration test.
|
178
|
+
Think of calling Rails generators, generating files with Thor and providing variables when compiling templates: "an example":https://github.com/archan937/rich_cms/blob/edge/suit/shared/test/suit_application.rb
|
179
|
+
|
180
|
+
h4. suit/shared/test/templates/==**/*.*==
|
181
|
+
|
182
|
+
The templates used by SuitApplication (and thus Thor) when generating files for test preparations.
|
183
|
+
You can write shared / Rails 2 specific / Rails 3 specific templates, "an example":https://github.com/archan937/rich_cms/tree/edge/suit/templates
|
184
|
+
|
185
|
+
h3. A GemSuit integration test
|
186
|
+
|
187
|
+
It is actually a simple @ActionController::IntegrationTest@ which requires @suit_application.rb@ instead of the regular @test_helper.rb@.
|
188
|
+
Also, two methods of @SuitApplication@ are called:
|
189
|
+
|
190
|
+
* @SuitApplication.test@ - Prepare the Rails dummy application for a certain environment (you can pass options to @SuitApplication@)
|
191
|
+
* @SuitApplication.restore_all@ - Restore the Rails dummy application source files after running the integration test
|
192
|
+
|
193
|
+
The basic structure:
|
194
|
+
|
195
|
+
<pre>
|
196
|
+
require File.expand_path("../../../suit_application.rb", __FILE__)
|
197
|
+
|
198
|
+
SuitApplication.test :some => :variable
|
199
|
+
|
200
|
+
class YourGemSuitIntegrationTest < GemSuit::IntegrationTest
|
201
|
+
|
202
|
+
context "My example test" do
|
203
|
+
setup do
|
204
|
+
# prepare something
|
205
|
+
end
|
206
|
+
|
207
|
+
teardown do
|
208
|
+
SuitApplication.restore_all
|
209
|
+
end
|
210
|
+
|
211
|
+
should "pass" do
|
212
|
+
# visit some pages
|
213
|
+
# click some links and fill in some forms
|
214
|
+
# assert some statements
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
</pre>
|
220
|
+
|
221
|
+
h3. SuitApplication class
|
222
|
+
|
223
|
+
This class prepares and restores the Rails dummy application when running a GemSuit integration test. You can leave it as is, but that wouldn't be fun.
|
224
|
+
|
225
|
+
*Note*: See "https://github.com/archan937/rich_cms/blob/edge/suit/shared/test/suit_application.rb":https://github.com/archan937/rich_cms/blob/edge/suit/shared/test/suit_application.rb for a real world example.
|
226
|
+
|
227
|
+
The following examples are combination with this GemSuit integration test:
|
228
|
+
|
229
|
+
<pre>
|
230
|
+
require File.expand_path("../../../suit_application.rb", __FILE__)
|
231
|
+
|
232
|
+
SuitApplication.test :authentication => :devise
|
233
|
+
|
234
|
+
class YourGemSuitIntegrationTest < GemSuit::IntegrationTest
|
235
|
+
...
|
236
|
+
</pre>
|
237
|
+
|
238
|
+
h4. Describe your test
|
239
|
+
|
240
|
+
This is the description used for a reference to the integration test. At default, GemSuit derives it based on the file name of the integration test.
|
241
|
+
|
242
|
+
<pre>
|
243
|
+
def description
|
244
|
+
case authentication
|
245
|
+
when :devise
|
246
|
+
"Devise authenticated"
|
247
|
+
else
|
248
|
+
"Non-authenticated"
|
249
|
+
end
|
250
|
+
end
|
251
|
+
</pre>
|
252
|
+
|
253
|
+
h4. Prepare your Rails dummy application with Thor
|
254
|
+
|
255
|
+
This is where you are supposed to run your generators and generate files using templates. You can also prevent source files from automatically included (which is the case for @test/suit_application/*.rb*@).
|
256
|
+
|
257
|
+
<pre>
|
258
|
+
def prepare
|
259
|
+
case config[:authentication]
|
260
|
+
when :devise
|
261
|
+
generate_devise_user
|
262
|
+
correct_devise_config
|
263
|
+
end
|
264
|
+
skip :require, "test/suit_application/rich/i18n_forgery.rb"
|
265
|
+
end
|
266
|
+
|
267
|
+
def locals_for_template(path)
|
268
|
+
case path
|
269
|
+
when "the/path/to/a/certain/template"
|
270
|
+
{:some_template_variable => "some_value"}
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
private
|
275
|
+
|
276
|
+
def generate_devise_user
|
277
|
+
generate "devise:install"
|
278
|
+
generate "devise", "User"
|
279
|
+
end
|
280
|
+
|
281
|
+
def correct_devise_config
|
282
|
+
devise_config = expand_path("config/initializers/devise.rb")
|
283
|
+
lines = File.open(devise_config).readlines
|
284
|
+
pepper = "a26c248ff40b12f4e396c1d33168408e2f442c3b6288df70ca46c340db3f1f2f7aa80ec37867ddfd602a185deda0b5efb27ecd8f7541b97d7c02e9485bbb57fd"
|
285
|
+
|
286
|
+
log :correcting, devise_config
|
287
|
+
File.open(devise_config, "w") do |file|
|
288
|
+
lines.each do |line|
|
289
|
+
file << line.gsub(/(config\.pepper = ").*(")/, "config.pepper = \"#{pepper}\"")
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
</pre>
|
294
|
+
|
295
|
+
h4. Stash and restore files
|
296
|
+
|
297
|
+
As you might have guessed, files are being stashed *before* testing and restored *after* testing.
|
298
|
+
|
299
|
+
<pre>
|
300
|
+
def restore_files
|
301
|
+
delete "config/locales/devise.en.yml"
|
302
|
+
delete "db/migrate/*.rb"
|
303
|
+
delete "test/fixtures/devise_users.yml"
|
304
|
+
delete "test/unit/devise_user_test.rb"
|
305
|
+
end
|
306
|
+
|
307
|
+
def stash_files
|
308
|
+
delete "db/migrate/*.rb"
|
309
|
+
stash "app/models/*.rb"
|
310
|
+
stash "config/initializers/devise.rb"
|
311
|
+
end
|
312
|
+
</pre>
|
313
|
+
|
314
|
+
h3. Capybara extensions
|
315
|
+
|
316
|
+
You can define helper methods for the integration tests when running with Capybara in @capybara_extensions.rb@.
|
317
|
+
Think of actions such as logging in, logging out and filling in forms:
|
318
|
+
|
319
|
+
<pre>
|
320
|
+
module GemSuit
|
321
|
+
class IntegrationTest
|
322
|
+
|
323
|
+
def login
|
324
|
+
visit "/cms"
|
325
|
+
page.execute_script "$('div#rich_cms_dock a.login').click()"
|
326
|
+
fill_in_and_submit "#raccoon_tip", {:Email => "paul.engel@holder.nl", :Password => "testrichcms"}, "Login"
|
327
|
+
end
|
328
|
+
|
329
|
+
def logout
|
330
|
+
find("#rich_cms_dock").click_link "Logout"
|
331
|
+
end
|
332
|
+
|
333
|
+
def mark_content
|
334
|
+
page.execute_script "$('div#rich_cms_dock a.mark').click()"
|
335
|
+
end
|
336
|
+
|
337
|
+
def edit_content(key)
|
338
|
+
page.execute_script "$('.rcms_content.marked[data-store_key=" + key + "]').click()"
|
339
|
+
assert find("#raccoon_tip").visible?
|
340
|
+
end
|
341
|
+
|
342
|
+
def fill_in_and_submit(selector, with, submit)
|
343
|
+
within "#{selector} fieldset.inputs" do
|
344
|
+
with.each do |key, value|
|
345
|
+
begin
|
346
|
+
fill_in key.to_s, :with => value
|
347
|
+
rescue Selenium::WebDriver::Error::ElementNotDisplayedError
|
348
|
+
page.execute_script "var input = $('#{selector} [name=\"#{key}\"]');" +
|
349
|
+
"if (input.data('cleditor')) {" +
|
350
|
+
" input.val('#{value}');" +
|
351
|
+
" input.data('cleditor').updateFrame();" +
|
352
|
+
"}"
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
find(selector).find_button(submit).click
|
357
|
+
sleep 2
|
358
|
+
end
|
359
|
+
|
360
|
+
end
|
361
|
+
end
|
362
|
+
</pre>
|
363
|
+
|
364
|
+
h2. Writing the "common" unit tests
|
365
|
+
|
366
|
+
The unit tests have to be located within @suit/shared/test/unit/@. Run the tests as mentioned earlier with @suit test unit@.
|
367
|
+
|
368
|
+
h2. Getting more info with Thor
|
369
|
+
|
370
|
+
As the GemSuit command line interface (CLI) is built with "@wycats":http://twitter.com/wycats "Thor":https://github.com/wycats/thor gem, you can use the @suit help@ command in your terminal:
|
371
|
+
|
372
|
+
<pre>
|
373
|
+
$ suit help
|
374
|
+
Tasks:
|
375
|
+
suit bundle # Run `bundle install` (should be invoked from a Rails dummy application) only when necessary (used for testing)
|
376
|
+
suit config [global] # Configure GemSuit within your gem (use `suit config global` for global config)
|
377
|
+
suit console [ENVIRONMENT] # Start one of the GemSuit test application consoles
|
378
|
+
suit fit # Establish the GemSuit in your environment
|
379
|
+
suit help [TASK] # Describe available tasks or one specific task
|
380
|
+
suit restore # Restore all files within the GemSuit test applications
|
381
|
+
suit server [ENVIRONMENT] # Start one of the GemSuit test application servers
|
382
|
+
suit tailor NAME # Generate a Bundler gem and provide it with GemSuit
|
383
|
+
suit test [SECTION] [FILES] # Run GemSuit (suit, unit, functional, integration) tests
|
384
|
+
suit up # Provide an existing gem with GemSuit
|
385
|
+
</pre>
|
386
|
+
|
387
|
+
To get info about the options of a command, narrow the output to that command. Just type @suit help <command>@:
|
388
|
+
|
389
|
+
<pre>
|
390
|
+
$ suit help server
|
391
|
+
Usage:
|
392
|
+
suit server [ENVIRONMENT]
|
393
|
+
|
394
|
+
Options:
|
395
|
+
-p, [--port=PORT]
|
396
|
+
-r, [--rails-version=RAILS_VERSION]
|
397
|
+
|
398
|
+
Start one of the GemSuit test application servers
|
399
|
+
</pre>
|
400
|
+
|
401
|
+
h2. So where are the tests?
|
402
|
+
|
403
|
+
As GemSuit is very focused on the command line and file generation, it is hard (but not impossible) to write tests. So therefore my test case is the entire "Rich-CMS":http://github.com/archan937/rich_cms gem. I am using GemSuit for all of its development and testing purposes.
|
404
|
+
|
405
|
+
h2. Contact me
|
406
|
+
|
407
|
+
For support, remarks and requests please mail me at "paul.engel@holder.nl":mailto:paul.engel@holder.nl.
|
408
|
+
|
409
|
+
h2. License
|
410
|
+
|
411
|
+
Copyright (c) 2011 Paul Engel, released under the MIT license
|
412
|
+
|
413
|
+
"http://holder.nl":http://holder.nl – "http://codehero.es":http://codehero.es – "http://gettopup.com":http://gettopup.com – "http://twitter.com/archan937":http://twitter.com/archan937 – "paul.engel@holder.nl":mailto:paul.engel@holder.nl
|
414
|
+
|
415
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
416
|
+
|
417
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
418
|
+
|
419
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rake/rdoctask"
|
6
|
+
|
7
|
+
desc "Default: run tests."
|
8
|
+
task :default => :test
|
9
|
+
|
10
|
+
desc "Test GemSuit."
|
11
|
+
Rake::TestTask.new(:test) do |t|
|
12
|
+
t.libs << "lib"
|
13
|
+
t.libs << "test"
|
14
|
+
t.pattern = "test/**/*_test.rb"
|
15
|
+
t.verbose = true
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Generate documentation for GemSuit."
|
19
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
20
|
+
rdoc.rdoc_dir = "rdoc"
|
21
|
+
rdoc.title = "GemSuit"
|
22
|
+
rdoc.options << "--line-numbers" << "--inline-source"
|
23
|
+
rdoc.rdoc_files.include "README.textile"
|
24
|
+
rdoc.rdoc_files.include "MIT-LICENSE"
|
25
|
+
rdoc.rdoc_files.include "lib/**/*.rb"
|
26
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/suit
ADDED
data/gem_suit.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "gem_suit/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "gem_suit"
|
7
|
+
s.version = GemSuit::VERSION::STRING
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Paul Engel"]
|
10
|
+
s.email = ["paul.engel@holder.nl"]
|
11
|
+
s.homepage = "https://github.com/archan937/gem_suit"
|
12
|
+
s.summary = %q{Test the entire usage workflow (including the generators) of your newly generated or existing gem within Rails 2 and 3 and make the gem development mobile}
|
13
|
+
s.description = %q{Test the entire usage workflow (including the generators) of your newly generated or existing gem within Rails 2 and 3 and make the gem development mobile}
|
14
|
+
|
15
|
+
s.rubyforge_project = "gem_suit"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency "rich_support", "~> 0.1.0"
|
23
|
+
s.add_dependency "thor" , "~> 0.14.6"
|
24
|
+
s.add_dependency "capybara" , "~> 0.4.1.2"
|
25
|
+
s.add_dependency "launchy" , "~> 0.4.0"
|
26
|
+
end
|