bundle exec rspec # Run all tests
bundle exec rspec spec/path/file.rb # Run specific file
bundle exec rspec -e "description" # Run matching examplesspec/
├── grape-swagger/
│ ├── entity_spec.rb # Main module specs
│ ├── entity/
│ │ ├── parser_spec.rb # Parser unit tests
│ │ └── attribute_parser_spec.rb
│ └── entities/
│ └── response_model_spec.rb # Integration tests
├── issues/ # Regression tests for GitHub issues
│ └── 962_polymorphic_entity_... # Named by issue number
└── support/
└── shared_contexts/ # Reusable test setup
Use shared contexts for common API setups:
require 'spec_helper'
require_relative '../../support/shared_contexts/this_api'
describe SomeClass do
include_context 'this api'
# ...
endWhen fixing a bug, create a spec in spec/issues/ named {issue_number}_{brief_description}_spec.rb:
# spec/issues/123_some_bug_spec.rb
require 'spec_helper'
describe '#123 brief description of the issue' do
# Test that reproduces and verifies the fix
endEnvironment variables control dependency versions:
GRAPE_VERSION=2.0.0 bundle update grape
GRAPE_SWAGGER_VERSION=HEAD bundle update grape-swagger
GRAPE_ENTITY_VERSION=1.0.1 bundle update grape-entity