Bdd is a User Story Framework. Add Acceptance Criteria documentation directly on your Ruby Tests.
Is It Working? | Is It Tested? | Code Quality | # of Downloads | Get Involved! |
---|---|---|---|---|
This gem provides the same benefits as gem Cucumber, and it's easier to use in projects. Works with all ruby test frameworks (RSpec and Minitest). Works with all test types (Capybara, units, features, etc). 1. Take your User Stories. 2. Write them as unobtrusive commentary in your test code. 3. Run your tests. 4. You'll see all your User Stories neatly organized in the output. 5. If your code breaks, that line will be highlighted in red.
Read more about User Stories on Wikipedia.
1. BEFORE | 2. AFTER |
3. RUN TESTS | 4. CHECK OUTPUT |
# Gemfile
group :development, :test do
gem 'rspec'
gem 'rspec-rails' # if you are using Rails
gem 'bdd'
end
# spec/spec_helper.rb
require 'bdd'
Bdd.configure do |config|
config.framework :rspec
config.reporters :output, :yaml
config.language %w[Given], %w[When Then], %w[And But]
# Optionally, add other languages:
# config.language pre_conditions, post_conditions, conjunctions
# config.language %w[Dado], %w[Quando Entao], %w[E Mas] # Portuguese
# config.language %w[Dato], %w[Cuando Entonces], %w[Y Mas] # Spanish
# config.language %w[Zakładając], %w[Jeśli To], %w[Także Ale] # Polish
end
# Gemfile
group :development, :test do
gem 'minitest'
gem 'minitest-rails' # if you are using Rails
gem 'bdd'
end
# test/test_helper.rb
require 'bdd'
Bdd.configure do |config|
config.framework :minitest
config.reporters :output, :yaml
config.language %w[Given], %w[When Then], %w[And But]
# Optionally, add other languages:
# config.language pre_conditions, post_conditions, conjunctions
# config.language %w[Dado], %w[Quando Entao], %w[E Mas] # Portuguese
# config.language %w[Dato], %w[Cuando Entonces], %w[Y Mas] # Spanish
# config.language %w[Zakładając], %w[Jeśli To], %w[Także Ale] # Polish
end
- Fork it ( https://github.com/thejamespinto/bdd/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Frameworks
- RSpec
- Minitest
- Reporters
- Output
- YAML
- HTML