All Projects β†’ r7kamura β†’ Rspec Request_describer

r7kamura / Rspec Request_describer

Licence: mit
An RSpec plugin to write self-documenting request-specs.

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
Test Prof
Ruby Tests Profiling Toolbox
Stars: ✭ 1,193 (+690.07%)
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
Fake ftp
A fake FTP server for use with ruby tests
Stars: ✭ 77 (-49.01%)
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
Websiteone
A website for Agile Ventures
Stars: ✭ 132 (-12.58%)
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

CircleCI Gem Version

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].