项目作者: yosefbennywidyo

项目描述 :
Setting Rails with BDD
高级语言: Ruby
项目地址: git://github.com/yosefbennywidyo/rails-bdd.git
创建时间: 2017-09-27T00:54:07Z
项目社区:https://github.com/yosefbennywidyo/rails-bdd

开源协议:

下载


README

Build Status
Build Status
Codeship Status for fybwid/rails-bdd
Coverage Status

Prerequisites

  • Ruby: 2.4.0p0
  • Rails: 5.1.4
  • PostgreSQL: 9.3

Prepared Rails for BDD

Skip unit test, bundle and used PostgreSQL

  1. rails new rails-bdd -T --skip-test-unit, -B --skip-bundle, -d postgresql

Install gem locally

  1. bundle install --path vendor/bundle

Add Rspec Rails gem to Gemfile

  1. group :development, :test do
  2. gem 'rspec-rails'
  3. end

Install Rspec Rails gem

  1. bundle

Bootstrap the application with RSpec

  1. bundle exec rails generate rspec:install

Add Shoulda Matchers gem to Gemfile

  1. group :test do
  2. gem 'shoulda-matchers'
  3. end

Configure Shoulda Matchers gem

Add the following block to the end of spec/rails_helper.rb

  1. Shoulda::Matchers.configure do |config|
  2. config.integrate do |with|
  3. with.test_framework :rspec
  4. with.library :rails
  5. end
  6. end

Added Cucumber gem

  1. group :test do
  2. gem 'shoulda-matchers'
  3. gem 'cucumber-rails', require: false
  4. gem 'database_cleaner'
  5. end

Install Cucumber gem

  1. bundle

Bootstrap the application with Cucumber

  1. rails generate cucumber:install

Testing

Running all test (RSpec and Cucumber)

bundle exec rake ci:tests

RSpec

Single test

rspec spec/models/post_spec.rb

All test

rspec

Cucumber

Single test

cucumber features/home_page.feature

All test

cucumber

  • Ruby version

  • System dependencies

  • Configuration

  • Database creation

  • Database initialization

  • How to run the test suite

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions