Permalink
Newer
Older
100644 108 lines (70 sloc) 4.3 KB
1
# Steak [![Build Status](http://travis-ci.org/cavalle/steak.png)](http://travis-ci.org/cavalle/steak)
2
3
The delicious combination of RSpec and Capybara for Acceptance BDD
4
5
![Steak!!](http://dl.dropbox.com/u/645329/steak_small.jpg "Steak!!")
6
7
## What is Steak?
8
9
Steak is a minimal extension of RSpec-Rails that adds several conveniences to do acceptance testing of Rails applications using Capybara. It's an alternative to Cucumber in plain Ruby. This is how an acceptance spec looks like in Steak:
12
13
background do
17
scenario 'should show existing quotes' do
18
create_quote :text => 'The language of friendship is not words, but meanings',
19
:author => 'Henry David Thoreau'
24
within('.quote') do
25
page.should have_content('The language of friendship is not words, but meanings')
26
page.should have_content('Henry David Thoreau')
27
end
28
end
29
30
end
31
32
No givens, whens or thens. No steps, no english, just Ruby. The delicious combination of RSpec and Capybara. That's Steak!
33
34
## Why Steak?
35
36
If, after all, this is just RSpec + Capybara, why does Steak even exist? Do I really need it?
37
38
Basically Steak exists for three reasons:
39
40
1. **Making a point**. First of all, Steak proposes that using RSpec and Capybara for acceptance testing is a sensible alternative to Cucumber. It also sets a name to refer to that approach.
41
1. **Adding convenience**. As a gem, Steak aims to make the experience as convenient as possible. It provides Rails integration testing support and several generators and rake tasks so that setting up a new project or creating and running specs are quick and seamless tasks. A natural extension of RSpec-Rails.
42
1. **Building a community**. No development approach or ruby gem is really valuable without an active community behind it. The mailing list, the IRC channel, the wiki or the twitter account are useful tools to build a community of users that help each other by sharing knowledge, resources and best practices.
43
44
## Getting Started
45
Jun 14, 2011
46
_NOTE: The current version of Steak (2.0) assumes that you're testing a Rails 3 application, with RSpec 2 and Capybara. For Rails 2, RSpec 1 or Webrat you should use [Steak 1](https://github.com/cavalle/steak/tree/steak-1) (or consider upgrading to non-obsolete technologies ;P)_
47
48
It's super-easy to get you started. Just add the gem to your `Gemfile`
49
Mar 14, 2011
50
group :test, :development do
Jun 14, 2011
51
gem 'steak'
52
# ...
53
54
…and then install the gem and run the generator:
55
56
$ bundle
57
$ rails g steak:install
58
59
You're now set up! Note that Steak is the only dependency you really need, you can safely remove any reference to `capybara`, `rspec-rails` or `rspec` from your `Gemfile`, they will be included by Steak. Also note that, unless previously executed, Steak will run the RSpec generator so you don't need to invoke it.
60
61
Take a look now at the default directory structure you've got under `spec/acceptance`. It will help you organize the helpers and configurations for your acceptance specs.
62
63
64
## Creating and running specs
65
66
You can create your specs by hand, however you may prefer to use the generator:
67
68
$ rails g steak:spec my_first_feature
69
70
To run your acceptance specs you just do like with any other spec…
71
72
$ bundle exec rspec spec/acceptance/my_first_feature_spec.rb
73
74
…or using rake:
75
76
$ rake spec:acceptance
77
78
## Resources
79
80
* [Source code](http://github.com/cavalle/steak) – Lurking and forking
81
* [Issues](http://github.com/cavalle/steak/issues) – Bugs and feature requests
82
* [Google Group](http://groups.google.com/group/steakrb) & [IRC channel](irc://irc.freenode.net/jenkinsci) – Help and discussion
83
* [Twitter](http://twitter.com/steakrb) – Announcements and mentions
84
* [Wiki](https://github.com/cavalle/steak/wiki) – Tutorials, docs and other resources
85
86
## Credits
87
88
Steak was created by [Luismi Cavallé](http://lmcavalle.com) and improved thanks to the love from:
89
90
* Álvaro Bautista
91
* Felipe Talavera
92
* Paco Guzmán
93
* Jeff Kreeftmeijer
94
* Jaime Iniesta
95
* Emili Parreño
96
* Andreas Wolff
97
* Wincent Colaiuta
98
* Falk Pauser
99
* Francesc Esplugas
100
* Raúl Murciano
101
* Enable Interactive
102
* Vojto Rinik
103
* Fred Wu
104
* Sergio Espeja
105
* Joao Carlos
106
107
Copyright © 2009 - 2011 Luismi Cavallé, released under the MIT license