Skip to content
/ poof Public

poof Ruby Gem - a gem for cleaning up test ActiveRecord instances

License

Notifications You must be signed in to change notification settings

Referly/poof

Repository files navigation

Circle CI

poof

poof Ruby Gem - a gem for cleaning up test ActiveRecord instances

usage

Add the following to your spec_helper.rb (or wherever you setup your RSpec examples)

require 'poof'

RSpec.configure do |conf|
    conf.include Poof::Syntax
end

Then in your example

describe 'speed limit' do

    before(:all) { Poof.start }

    after(:all) { Poof.end }

    subject { road.speed_limit }

    context 'when on the highway' do

        let(:road) { poof! create(:road_factory, type: :highway) }

        it 'is 55 mph' do
            expect(subject).to eq 55
        end
    end

    context 'when near children' do

        let(:road) { poof! create(:road_factory, type: :school_road) }

        it 'is 25 mph' do
            expect(subject).to eq 25
        end
    end
end

That's it, the records created for the test will be cleaned up for you automatically.

About

poof Ruby Gem - a gem for cleaning up test ActiveRecord instances

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages