r7kamura / Rspec Request_describer
Licence: mit
An RSpec plugin to write self-documenting request-specs.
Stars: β 151
Programming Languages
ruby
36898 projects - #4 most used programming language
Labels
Projects that are alternatives of or similar to Rspec Request describer
Email Spec
Collection of RSpec/MiniTest matchers and Cucumber steps for testing email in a ruby app using ActionMailer or Pony
Stars: β 1,142 (+656.29%)
Mutual labels: rspec
Rails Testing Toolbox
π§ Tools to help Rails developers test
Stars: β 110 (-27.15%)
Mutual labels: rspec
Mumuki Laboratory
π¬ Where students practice and receive automated and human feedback
Stars: β 131 (-13.25%)
Mutual labels: rspec
Rspec api documentation
Automatically generate API documentation from RSpec
Stars: β 1,366 (+804.64%)
Mutual labels: rspec
Lurker
π The ultimate tool for documenting and testing APIs in Rails
Stars: β 120 (-20.53%)
Mutual labels: rspec
Dicas De Programacao Em Ruby
Dicas para iniciantes de boas prΓ‘ticas de desenvolvimento de software em Ruby
Stars: β 59 (-60.93%)
Mutual labels: rspec
Spectrum
A BDD-style test runner for Java 8. Inspired by Jasmine, RSpec, and Cucumber.
Stars: β 142 (-5.96%)
Mutual labels: rspec
Accept values for
Rspec matchers to test ActiveModel validation that follows BDD.
Stars: β 103 (-31.79%)
Mutual labels: rspec
Rspec Openapi
Generate OpenAPI schema from RSpec request specs
Stars: β 129 (-14.57%)
Mutual labels: rspec
Mutest
fork of mutant with inline disable comments and a few different mutations.
Stars: β 75 (-50.33%)
Mutual labels: rspec
Rspecq
Optimally distribute and run RSpec suites among parallel workers; for faster CI builds
Stars: β 122 (-19.21%)
Mutual labels: rspec
Ifme
Free, open source mental health communication web app to share experiences with loved ones
Stars: β 1,147 (+659.6%)
Mutual labels: rspec
Rspec Hue formatter
Bring RSpec integration into your room with Philips Hue
Stars: β 59 (-60.93%)
Mutual labels: rspec
With model
Dynamically build an Active Record model (with table) within a test context
Stars: β 119 (-21.19%)
Mutual labels: rspec
Rails new
A thoughtfully designed template for building modern Rails apps. Get started in minutes instead of hours π₯π
Stars: β 151 (+0%)
Mutual labels: rspec
Mutant
Automated code reviews via mutation testing - semantic code coverage.
Stars: β 1,794 (+1088.08%)
Mutual labels: rspec
Base App
An app to help jumpstart a new Rails 4 app. Features Ruby 2.0, PostgreSQL, jQuery, RSpec, Cucumber, user and admin system built with Devise, Facebook login.
Stars: β 127 (-15.89%)
Mutual labels: rspec
RSpec::RequestDescriber
An RSpec plugin to write self-documenting request-specs.
This gem is designed for:
Setup
Install
Add this line to your application's Gemfile:
gem 'rspec-request_describer'
And then execute:
bundle
Or install it yourself as:
gem install rspec-request_describer
Include
Include RSpec::RequestDescriber
to your example groups like this:
require 'rspec/request_describer'
RSpec.configuration.include RSpec::RequestDescriber, type: :request
Usage
subject
RSpec::RequestDescriber
provides subject
from its top-level description.
# subject will be `get('/users')`.
RSpec.describe 'GET /users' do
it { is_expected.to eq(200) }
end
headers
If you want to modify request headers, change headers
before calling subject
.
# `subject` will be `get('/users', headers: { 'Authorization' => 'token 12345' })`.
RSpec.describe 'GET /users' do
context 'with Authorization header' do
before do
headers['Authorization'] = 'token 12345'
end
it { is_expected.to eq(200) }
end
end
params
If you want to modify request parameters, change params
before calling subject
.
# `subject` will be `get('/users', params: { 'sort' => 'id' })`.
RSpec.describe 'GET /users' do
context 'with sort parameter' do
before do
params['sort'] = 'id'
end
it 'returns users in ID order' do
is_expected.to eq(200)
users = JSON.parse(response.body)
expect(users[0]['id']).to eq(1)
expect(users[1]['id']).to eq(2)
end
end
end
variables in URL path
You can embed variables in URL path like /users/:id
.
In this example, the returned value of id
method will be emobeded as its real value.
# `subject` will be `get("/users/#{user_id}")`.
RSpec.describe 'GET /users/:user_id' do
let(:user) do
User.create(name: 'alice')
end
let(:user_id) do
user.id
end
it { is_expected.to eq(200) }
end
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].