actually write some docs

This commit is contained in:
John Bintz 2013-01-24 19:32:46 -05:00
parent 7e3e251dfb
commit eb11223b23
5 changed files with 86 additions and 35 deletions

View File

@ -1,29 +1,79 @@
# Cuke::Pack
# cuke-pack
TODO: Write a gem description
Common Cucumber setups to make things go fast and smooth.
## Installation
## Install it
Add this line to your application's Gemfile:
``` ruby
# Gemfile
gem 'cuke-pack'
```
And then execute:
``` bash
bundle exec cuke-pack install
```
$ bundle
This will overwrite your `config/cucumber.yml` file with one that plugs in nicely with Guard. It also adds a new config file in
`features/support/cuke-pack.rb`.
Or install it yourself as:
## Specifying the driver
$ gem install cuke-pack
If you have other Capybara drivers installed like Poltergeist of persistent_selenium, you can specify the driver as an
environment variable:
## Usage
``` bash
DRIVER=poltergeist bundle exec cucumber
```
TODO: Write usage instructions here
## Confirming JavaScript
## Contributing
If you need to confirm an `alert()` or `confirm()`, you can do so in your step with `confirm_js`. Just replaces
`window.alert` and `window.confirm` with functions that return true.
## Step Writer
Enables [cucumber-step_writer](http://github.com/johnbintz/cucumber-step_writer) for you.
## Flay your steps
I can get duplicate code in my steps pretty quickly. Sometimes I flay them to see where the duplicates are and then I
factor out the common code.
## Hijacking `@wip`
I personally think the original use of `@wip` in Cucumber is silly. Why would you commit non-working
features to the source repository? So this project re-purposes `@wip` to let you focus your Cucumber test
runs on a single feature and work on it until it runs:
### Guard
If you're using Guard for continuous testing, install the `wip` guard:
``` bash
bundle exec cuke-pack wip-guard
```
You can then use Guard to only run scenarios with the tag `@wip`:
``` bash
bundle exec guard -g wip
```
### Precommit
If you run tests before committing your code with a tool like [penchant](http://github.com/johnbintz/penchant),
you can configure your tests to run using the `precommit` profile. This one ensures that there are no
`@wip` scenarios. It also lets you skip certain features/scenarios that are tagged `@no-precommit`. Good for
turning off tests that you haven't needed to touch in a while. Just be careful with it!
## Other things
You can easily enable FakeFS, Mocha, and Timecop if you need them. Turn them on in `cuke-pack.rb` and then use
the right tag on your scenario.
## Old things
There's some stuff that is so deprecated that I'll remove it eventually, once all my other offending projects
don't use them anymore. You shouldn't use them either.
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

View File

@ -1,4 +1,5 @@
def expect_fields(object, *fields, &block)
$stderr.puts "expect_fields deprecated. Use semantic_rails_view_helpers instead."
@__expect_stack ||= 0
@__expect_stack += 1

View File

@ -48,6 +48,8 @@ class WaitingForElementFailure < StandardError
end
def wait_for(times = MAX_TIMES, &block)
$stderr.puts "wait_for deprecated. Just use find."
1.upto(times) do
ok = false
@ -68,6 +70,8 @@ def wait_for(times = MAX_TIMES, &block)
end
def wait_for_not(times = MAX_TIMES, &block)
$stderr.puts "wait_for_not deprecated. Just use find."
original_time = Capybara.default_wait_time
Capybara.default_wait_time = 0

View File

@ -3,6 +3,10 @@ std_opts = "-r features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} -f Cucumb
%>
default: <%= std_opts %> features
wip: <%= std_opts %> --tags @wip features
precommit: FAILFAST=true <%= std_opts %> --tags ~@wip:0 features
precommit: <%= std_opts %> --tags ~@wip:0 --tags @no-precommit features
# or enable FAILFAST to have your tests end immediately on failure
#precommit: FAILFAST=true <%= std_opts %> --tags ~@wip:0 features
cleanup: <%= std_opts %> -f Cucumber::CleanupFormatter --out unused.txt features

View File

@ -1,36 +1,28 @@
require 'cuke-pack/support/pause'
require 'cuke-pack/support/pending'
# use confirm_js in your step to confirm all alert() and confirm() dialogs
require 'cuke-pack/support/confirm_js'
require 'cuke-pack/support/expect_fields'
Before do
# if you want pending steps to pause before marking the step as pending,
# set @pause_ok to true
@pause_ok = false
end
# write out missing steps automatically
require 'cuke-pack/support/step_writer'
require 'cuke-pack/support/wait_for'
# fail instantly if ENV['FAILFAST'] is set
require 'cuke-pack/support/failfast'
# set the level of flaying on the step definitions
# set it to false to skip flaying
flay_level = 32
require 'cuke-pack/support/flay'
# enable fakefs with @fakefs
# require 'cuke-pack/support/fakefs'
# enable mocha with @mocha
# require 'cuke-pack/support/mocha'
# Timecop support
# Timecop support with @timecop
# require 'cuke-pack/support/timecop'
# Browser drivers
# use with ENV['DRIVER']
require 'cuke-pack/drivers'
# require 'cuke-pack/driver/firefox'
#
# Simple rails controller/view generator
# probably only any good for me
# require 'cuke-pack/support/rails_generator'