Skip to content

Instantly share code, notes, and snippets.

@johana-star
Created March 10, 2016 19:04
Show Gist options
  • Save johana-star/18c1b6872bc39314ef47 to your computer and use it in GitHub Desktop.
Save johana-star/18c1b6872bc39314ef47 to your computer and use it in GitHub Desktop.
RSpec example of order-dependent failure.
RSpec.configure do |config|
config.order = :random
end
class Global
@@counter = 0
def self.counter; @@counter; end
def self.increment_counter; @@counter += 1; end
end
RSpec.describe Global do
it "#counter is initialized to zero" do
expect(described_class.counter).to eq 0
end
it "#increment_counter adds one to #counter" do
described_class.increment_counter
expect(described_class.counter).to eq 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment