Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rspec-example_steps

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rspec-example_steps

  • 3.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

RSpec example steps

Given/When/Then/And/But steps for RSpec examples

Description

This gem brings two major functionality to your spec/features

  • Verbosity for rspec documentation formatter.
  • Ability to comment or describe set of actions in example into some step.

Installation

  • For rspec v2 use gem v0.2.x or rspec2 branch
  • For rspec v3 use gem v3.x.x or master branch
gem 'rspec-example_steps'

Add to spec/spec_helper.rb

require 'rspec/example_steps'

Example

spec/features/search_spec.rb

context 'Searching' do
  Steps 'Result found' do
    Given 'I am on search page' do
      visit '/search'
      expect(page).to have_content('Search')
    end

    When 'I search something' do
      fill_in 'Search', with: 'John'
      click_button 'Go'
    end

    Then 'I should see result' do
      expect(page).to have_content('Result')
    end
  end
end

Documentation formatting output:

rspec -fd spec/features/search_spec.rb

Searching
  User succesfully replaces device
    Given I am on search page
    When I search something
    Then I should see result

Pending steps

Simular to Example :pending behavior:

Steps 'User login' do
  # just skip block
  When 'I go to login'

  # pass pending: true option
  Then 'I should see welcome', pending: true do
  ...
  end

  # pass pending: 'some pending message'
  Then 'I should see last login IP', pending: 'WIP' do
  ...
  end
end

Authors

  • Andriy Yanko

License

Alternatives

FAQs

Package last updated on 01 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc