Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
makicamel committed Jul 7, 2024
1 parent 37624bd commit f5d8e54
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/integration/bisect_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ def bisect(cli_args, expected_status=nil)
end
end

context "when the spec ordering is consistent" do
it 'returns the minimal reproduction command' do
output = bisect(%w[
--order defined
spec/rspec/core/resources/bisect/consistently_ordered_1_specs.rb
spec/rspec/core/resources/bisect/consistently_ordered_2_specs.rb
spec/rspec/core/resources/bisect/consistently_ordered_3_specs.rb
spec/rspec/core/resources/bisect/consistently_ordered_4_specs.rb
])
expect(output).to include("Bisect complete!", "rspec ./spec/rspec/core/resources/bisect/consistently_ordered_2_specs.rb[1:1] ./spec/rspec/core/resources/bisect/consistently_ordered_3_specs.rb[1:1]")
end
end

context "when the bisect command saturates the pipe" do
# On OSX and Linux a file descriptor limit meant that the bisect process got stuck at a certain limit.
# This test demonstrates that we can run large bisects above this limit (found to be at time of commit).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Deliberately named _specs.rb to avoid being loaded except when specified

RSpec.describe "Order1" do
it("passes") { expect(1).to eq 1 }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Deliberately named _specs.rb to avoid being loaded except when specified

require "rspec/core/resources/bisect/frieren_quote"

RSpec.describe "Order2" do
before { FrierenQuote.change }

it("passes") { expect(1).to eq 1 }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Deliberately named _specs.rb to avoid being loaded except when specified

require "rspec/core/resources/bisect/frieren_quote"

RSpec.describe "Order3" do
it("fails order-dependency") { expect(FrierenQuote.one).to eq "That is what hero Himmel would have done." }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Deliberately named _specs.rb to avoid being loaded except when specified

RSpec.describe "Order4" do
it("passes") { expect(1).to eq 1 }
end
12 changes: 12 additions & 0 deletions spec/rspec/core/resources/bisect/frieren_quote.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class FrierenQuote
class << self
def one
@@one ||= "That is what hero Himmel would have done."
end

def change
@@one = "The greatest enjoyment comes only during the pursuit of magic, you know."
end
end
end

0 comments on commit f5d8e54

Please sign in to comment.