cuke-pack 0.0.1 → 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/README.md +67 -17
- data/lib/cuke-pack/support/expect_fields.rb +1 -0
- data/lib/cuke-pack/support/wait_for.rb +4 -0
- data/lib/cuke-pack/version.rb +1 -1
- data/skel/config/cucumber.yml +6 -2
- data/skel/features/support/cuke-pack.rb +9 -17
- metadata +2 -2
data/README.md
CHANGED
@@ -1,29 +1,79 @@
|
|
1
|
-
#
|
1
|
+
# cuke-pack
|
2
2
|
|
3
|
-
|
3
|
+
Common Cucumber setups to make things go fast and smooth.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Install it
|
6
6
|
|
7
|
-
|
7
|
+
``` ruby
|
8
|
+
# Gemfile
|
8
9
|
|
9
|
-
|
10
|
+
gem 'cuke-pack'
|
11
|
+
```
|
10
12
|
|
11
|
-
|
13
|
+
``` bash
|
14
|
+
bundle exec cuke-pack install
|
15
|
+
```
|
12
16
|
|
13
|
-
|
17
|
+
This will overwrite your `config/cucumber.yml` file with one that plugs in nicely with Guard. It also adds a new config file in
|
18
|
+
`features/support/cuke-pack.rb`.
|
14
19
|
|
15
|
-
|
20
|
+
## Specifying the driver
|
16
21
|
|
17
|
-
|
22
|
+
If you have other Capybara drivers installed like Poltergeist of persistent_selenium, you can specify the driver as an
|
23
|
+
environment variable:
|
18
24
|
|
19
|
-
|
25
|
+
``` bash
|
26
|
+
DRIVER=poltergeist bundle exec cucumber
|
27
|
+
```
|
20
28
|
|
21
|
-
|
29
|
+
## Confirming JavaScript
|
22
30
|
|
23
|
-
|
31
|
+
If you need to confirm an `alert()` or `confirm()`, you can do so in your step with `confirm_js`. Just replaces
|
32
|
+
`window.alert` and `window.confirm` with functions that return true.
|
33
|
+
|
34
|
+
## Step Writer
|
35
|
+
|
36
|
+
Enables [cucumber-step_writer](http://github.com/johnbintz/cucumber-step_writer) for you.
|
37
|
+
|
38
|
+
## Flay your steps
|
39
|
+
|
40
|
+
I can get duplicate code in my steps pretty quickly. Sometimes I flay them to see where the duplicates are and then I
|
41
|
+
factor out the common code.
|
42
|
+
|
43
|
+
## Hijacking `@wip`
|
44
|
+
|
45
|
+
I personally think the original use of `@wip` in Cucumber is silly. Why would you commit non-working
|
46
|
+
features to the source repository? So this project re-purposes `@wip` to let you focus your Cucumber test
|
47
|
+
runs on a single feature and work on it until it runs:
|
48
|
+
|
49
|
+
### Guard
|
50
|
+
|
51
|
+
If you're using Guard for continuous testing, install the `wip` guard:
|
52
|
+
|
53
|
+
``` bash
|
54
|
+
bundle exec cuke-pack wip-guard
|
55
|
+
```
|
56
|
+
|
57
|
+
You can then use Guard to only run scenarios with the tag `@wip`:
|
58
|
+
|
59
|
+
``` bash
|
60
|
+
bundle exec guard -g wip
|
61
|
+
```
|
62
|
+
|
63
|
+
### Precommit
|
64
|
+
|
65
|
+
If you run tests before committing your code with a tool like [penchant](http://github.com/johnbintz/penchant),
|
66
|
+
you can configure your tests to run using the `precommit` profile. This one ensures that there are no
|
67
|
+
`@wip` scenarios. It also lets you skip certain features/scenarios that are tagged `@no-precommit`. Good for
|
68
|
+
turning off tests that you haven't needed to touch in a while. Just be careful with it!
|
69
|
+
|
70
|
+
## Other things
|
71
|
+
|
72
|
+
You can easily enable FakeFS, Mocha, and Timecop if you need them. Turn them on in `cuke-pack.rb` and then use
|
73
|
+
the right tag on your scenario.
|
74
|
+
|
75
|
+
## Old things
|
76
|
+
|
77
|
+
There's some stuff that is so deprecated that I'll remove it eventually, once all my other offending projects
|
78
|
+
don't use them anymore. You shouldn't use them either.
|
24
79
|
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
@@ -48,6 +48,8 @@ class WaitingForElementFailure < StandardError
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def wait_for(times = MAX_TIMES, &block)
|
51
|
+
$stderr.puts "wait_for deprecated. Just use find."
|
52
|
+
|
51
53
|
1.upto(times) do
|
52
54
|
ok = false
|
53
55
|
|
@@ -68,6 +70,8 @@ def wait_for(times = MAX_TIMES, &block)
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def wait_for_not(times = MAX_TIMES, &block)
|
73
|
+
$stderr.puts "wait_for_not deprecated. Just use find."
|
74
|
+
|
71
75
|
original_time = Capybara.default_wait_time
|
72
76
|
Capybara.default_wait_time = 0
|
73
77
|
|
data/lib/cuke-pack/version.rb
CHANGED
data/skel/config/cucumber.yml
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
<%
|
2
|
-
std_opts = "-r features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} -f Cucumber::StepWriter --out features/step_definitions --strict"
|
2
|
+
std_opts = "--color -r features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} -f Cucumber::StepWriter --out features/step_definitions --strict"
|
3
3
|
%>
|
4
4
|
default: <%= std_opts %> features
|
5
5
|
wip: <%= std_opts %> --tags @wip features
|
6
|
-
precommit:
|
6
|
+
precommit: <%= std_opts %> --tags ~@wip:0 --tags ~@no-precommit features
|
7
|
+
|
8
|
+
# or enable FAILFAST to have your tests end immediately on failure
|
9
|
+
#precommit: FAILFAST=true <%= std_opts %> --tags ~@wip:0 features
|
10
|
+
|
7
11
|
cleanup: <%= std_opts %> -f Cucumber::CleanupFormatter --out unused.txt features
|
8
12
|
|
@@ -1,36 +1,28 @@
|
|
1
|
-
|
2
|
-
require 'cuke-pack/support/pending'
|
1
|
+
# use confirm_js in your step to confirm all alert() and confirm() dialogs
|
3
2
|
require 'cuke-pack/support/confirm_js'
|
4
|
-
require 'cuke-pack/support/expect_fields'
|
5
|
-
|
6
|
-
Before do
|
7
|
-
# if you want pending steps to pause before marking the step as pending,
|
8
|
-
# set @pause_ok to true
|
9
|
-
|
10
|
-
@pause_ok = false
|
11
|
-
end
|
12
3
|
|
4
|
+
# write out missing steps automatically
|
13
5
|
require 'cuke-pack/support/step_writer'
|
14
|
-
|
6
|
+
|
7
|
+
# fail instantly if ENV['FAILFAST'] is set
|
15
8
|
require 'cuke-pack/support/failfast'
|
16
9
|
|
17
10
|
# set the level of flaying on the step definitions
|
18
11
|
# set it to false to skip flaying
|
19
12
|
flay_level = 32
|
20
|
-
|
21
13
|
require 'cuke-pack/support/flay'
|
22
14
|
|
15
|
+
# enable fakefs with @fakefs
|
23
16
|
# require 'cuke-pack/support/fakefs'
|
17
|
+
|
18
|
+
# enable mocha with @mocha
|
24
19
|
# require 'cuke-pack/support/mocha'
|
25
20
|
|
26
|
-
# Timecop support
|
21
|
+
# Timecop support with @timecop
|
27
22
|
# require 'cuke-pack/support/timecop'
|
28
23
|
|
29
24
|
# Browser drivers
|
30
25
|
# use with ENV['DRIVER']
|
26
|
+
require 'cuke-pack/drivers'
|
31
27
|
# require 'cuke-pack/driver/firefox'
|
32
|
-
#
|
33
|
-
# Simple rails controller/view generator
|
34
|
-
# probably only any good for me
|
35
|
-
# require 'cuke-pack/support/rails_generator'
|
36
28
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke-pack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|