Joined August 2014
·

Björn Richter

-
·
·

I'm new to Rspec but either this method does not work anymore or it contains an error.
Anyways with Ruby >= 2.0 and Rspec >= 3.0 you have to give the bloc a parameter:

before do |example|
    unless example.metadata[:skip_before]
        # before body
    end
end

it "does something" do
    # before hook will run before this example
end

it "does something else", :skip_before do
    # before hook will be skipped
end

and you also do not need skip_before: true, you can just use :skip_before

But thanks for the hint :)

Achievements
1 Karma
0 Total ProTip Views
Interests & Skills