0.0
No commit activity in last 3 years
No release in over 3 years
Adds an "action" method to rspec examples, which is a last "before" in fact
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0

Runtime

~> 2.13
 Project Readme

Build Status Code Climate

rspec-action

An extension to rspec, which provides an action command to rspec examples

Description

rspec-action is an extension to rspec2, which allows you to specify the last before hook. I named it action, because it's quite helpful for me in the controller specs.

IMPORTANT
Use rspec-action 1.2.0 for Rspec 2.13

Use rspec-action 1.1.0 for Rspec 2.12

Use rspec-action 1.0.0 for Rspec 2.11 or lower.

I prefer to write

describe "GET index" do
  action { get :index }

  context 'if user signed in' do
    before { sign_in user }
    it { should respond_with :success }
  end

  context 'if user signed out' do
    it { should redirect_to sign_in_path }
  end
end

instead of

describe "GET index" do
  context 'if user signed in' do
    before { sign_in user }
    before { get :index }
    it { should respond_with :success }
  end

  context 'if user signed out' do
    before { get :index }
    it { should redirect_to sign_in_path }
  end
end

Requirements

Installation

gem install rspec-action