
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Provides a simple DSL on top of RSpec for defining a series of spec execution steps. Particularly useful for describing of human-readable integration testing scenarios.
RSpec Stepwise provides the following guarantees within the same steps group:
let
etc.Configure RSpec to use stepwise DSL:
require 'rspec/stepwise'
RSpec.configure do |config|
config.extend RSpec::Stepwise
# ...
end
This adds stepwise
method for creating ordered example groups and step
method for describing particular step in a chain. See full usage example:
RSpec.describe 'User Scenarios' do
# Defines example group for account confirmation scenario.
# All steps within this group will run in an order.
stepwise 'Account Confirmation' do
# All RSpec APIs works as usual inside both group and steps.
let(:api) { ClientApi.new }
let(:mailbox) { Mailbox.new }
let(:user) { User.new }
step 'register' do
api.register(user)
end
step 'unable to sign in' do
response = api.sign_in(user)
expect(response).to be_forbidden
end
step 'confirm' do
mailbox.confirm(user)
fail 'Email not found in mailbox'
end
# This step will not be executed because previous one failed.
step 'successfully sign in' do
response = api.sign_in(user)
expect(response).to be_successfull
end
# Called after all steps, even if one failed.
after do
mailbox.clear
end
# Called only when a step failed.
on_fail do
puts api.logs
end
end
end
RSpec doubles should not be used in a shared stepwise context, otherwise it leads to:
#<Double ...> was originally created in one example but has leaked into another example and can no longer be used. rspec-mocks' doubles are designed to only last for one example, and you need to create a new one in each example you wish to use it for.
So this will not work:
stepwise do
let(:api) { double(:api, call: nil) }
step 'one' do
api.call
end
step 'another' do
api.call
end
end
Instead you have to do something like:
stepwise do
step 'one' do
api = double(:api, call: nil)
api.call
end
step 'another' do
api = double(:api, call: nil)
api.call
end
end
Using Bundler:
gem 'rspec-stepwise', '~> 0.1.0'
Or using rubygems:
gem install rspec-stepwise
Bug reports and pull requests are welcome on GitHub at https://github.com/nikitug/rspec-stepwise.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that rspec-stepwise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.