Skip to content

Instantly share code, notes, and snippets.

@mariash
Last active August 29, 2015 14:06
Show Gist options
  • Save mariash/9f14d8e87f180acc0b3b to your computer and use it in GitHub Desktop.
Save mariash/9f14d8e87f180acc0b3b to your computer and use it in GitHub Desktop.
Rspec skip in before(:all) exits with 1

→ cat test_spec.rb

describe "hello" do
  before do
    skip "skipped"
  end
  it "works" do
  end
end

→ rspec test_spec.rb

*

Pending:
  hello works
    # skipped
    # ./test_spec.rb:5

Finished in 0.00031 seconds (files took 0.09723 seconds to load)
1 example, 0 failures, 1 pending

→ echo $?

0

→ vim test_spec.rb # Change before to before(:all)

→ cat test_spec.rb

describe "hello" do
  before(:all) do
    skip "skipped"
  end
  it "works" do
  end
end

→ rspec test_spec.rb

*

Pending:
  hello works
    # skipped
    # ./test_spec.rb:5

Finished in 0.00023 seconds (files took 0.09867 seconds to load)
1 example, 0 failures, 1 pending

→ echo $?

1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment