Skip to content

Commit

Permalink
Avoid use of method chaining in provenance spec
Browse files Browse the repository at this point in the history
This unifies behavior across all Ruby versions, so we don't need
the complex conditional.
  • Loading branch information
jeremyevans committed Apr 7, 2024
1 parent 2dd31a7 commit e437cef
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions spec/extensions/provenance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,17 @@
@ds = Sequel.mock.dataset.extension(:provenance)
end

line = __LINE__ + 2
line = __LINE__ + 1
def ds
@ds.
from(:t).
select(:a).
where(:c)
ds = @ds.from(:t)
ds = ds.select(:a)
ds = ds.where(:c)
ds
end

if RUBY_ENGINE == 'jruby' && RUBY_VERSION >= '3.1'
line1 = line2 = line3 = line + 3
elsif RUBY_ENGINE == 'jruby' && RUBY_VERSION < '2.6'
line1 = line2 = line3 = line
elsif RUBY_VERSION >= '2'
line1 = line+1
line2 = line+2
line3 = line+3
else
line1 = line2 = line3 = line
end
line1 = line+1
line2 = line+2
line3 = line+3

it "should not include provenance comment if there is no comment" do
@ds.sql.must_equal 'SELECT *'
Expand Down

0 comments on commit e437cef

Please sign in to comment.