Skip to content

Initialize instance variables for RSpec on before :suite hook.

License

Notifications You must be signed in to change notification settings

keshihoriuchi/rspec-suite_initializer

Repository files navigation

RSpec::SuiteInitializer

Initialize instance variables for RSpec on before :suite hook.

Installation

gem 'rspec-suite_initializer'

Usage

require 'rspec/suite_initializer'

RSpec::SuiteInitializer.before_suite do |v|
  v[:foo] = 'foo'
  v[:bar] = 'bar'
end

RSpec.describe RSpec::SuiteInitializer do
  context 'When use variable defined at before_suite' do
    subject { [@foo, @bar] }
    it { is_expected.to eq(['foo', 'bar']) }
  end
end

When require rspec/suite_initializer, defines RSpec.configuration.suite_initializer.

About

Initialize instance variables for RSpec on before :suite hook.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages