RspecSupport
A helpful collection of bits and bobs.
Usage
-
define_class
, so you can define per-scenario classes without leaking into the global namespace:it 'uses a local class' do define_constant(MyClass) do # Everything in this block is class-evaled. The block is optional. def hello "hello" end end expect(MyClass.new.hello).to eq "hello" end it 'is not available everywhere' do expect { MyClass.new }.to raise_error(NameError, /uninitialized constant/) end
Installation
Add this line to your application's Gemfile:
gem 'rspec_support'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec_support
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request