https://github.com/madetech/bdd-rails
A starter kit for testing BDD in rails
https://github.com/madetech/bdd-rails
Last synced: 12 months ago
JSON representation
A starter kit for testing BDD in rails
- Host: GitHub
- URL: https://github.com/madetech/bdd-rails
- Owner: madetech
- Created: 2016-04-05T21:06:40.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T23:02:37.000Z (over 7 years ago)
- Last Synced: 2025-05-16T21:47:58.236Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 25.4 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BDD Rails: A starter kit
[](https://badge.fury.io/rb/bdd-rails)
[](https://travis-ci.org/madetech/bdd-rails)
Hello there! So you think BDD is a great way to talk about software? Are you
ready to codify some of those conversations? Do you build apps in rails? If
so you've come to the right place.
`bdd-rails` was built to provide a set of generators for a rails app. We provide
an opinionated setup for using rspec + capybara to feature test your
application.
## BDD starts with conversations
Many think BDD is about a certain testing style, it is and it isn't. BDD is much
more about the conversations around the desired and undesired behaviour of a
system.
If you're not having conversations about your system in a BDD style then that
is where you should start!
## Codifying Behaviour
Coming soon... for now read the following articles to find out about the style
of tests we're writing:
- http://lukemorton.co.uk/thoughts/2016-01-09-feature-testing-in-2016
- https://about.futurelearn.com/blog/how-we-write-readable-feature-tests-with-rspec/
- https://www.madetech.com/blog/feature-testing-with-rspec
### Creating a new rails app
Firstly, make sure you have rails installed!
```
gem install rails
```
Now let's create a new app!
```
rails new --skip-test-unit my_bdd_app
cd my_bdd_app
```
Next we want to install `bdd-rails`:
```
echo "gem 'bdd-rails', path: '../../'" >> Gemfile
bundle
```
We want to install our BDD setup in your rails app:
```
bundle exec rails g bdd_rails:install
```
And setup our DB:
```
bundle exec rake db:migrate
```
Now you can run your (empty) test suite:
```
bundle exec rspec
```
### How about an example?
To install a full example of feature test and code into your application run
the following:
```
bundle exec rails g bdd_rails:example
bundle exec rspec
```
Now you have a passing example! Feel free to explore the example code :)