Skip to content

Commit

Permalink
Skip CPK tests before Rails 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jackozi committed Jul 13, 2024
1 parent f855c01 commit 61c3a52
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
require "minitest/hooks/test"
require "minitest/autorun"
require "mocha/minitest"

RAILS_VERSION_WITTH_COMPOSITE_PRIMARY_KEYS = Gem::Version.new("7.1.0")
16 changes: 16 additions & 0 deletions test/test_positioning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def test_primary_key
end

def test_composite_primary_key
skip "Compsite primary keys are not yet supported in this Rails version." if ActiveRecord.version < RAILS_VERSION_WITTH_COMPOSITE_PRIMARY_KEYS

list = List.create name: "List"
item = list.item_with_composite_primary_keys.create item_id: "1", account_id: "1"

Expand Down Expand Up @@ -204,6 +206,20 @@ def test_position
assert_equal 2, mechanisms.send(:position)
end

def test_cpk_position
skip "Compsite primary keys are not yet supported in this Rails version." if ActiveRecord.version < RAILS_VERSION_WITTH_COMPOSITE_PRIMARY_KEYS

list = List.create name: "List"
item1 = list.item_with_composite_primary_keys.create item_id: "1", account_id: "1"
item2 = list.item_with_composite_primary_keys.create item_id: "2", account_id: "1"

mechanisms = Positioning::Mechanisms.new(item1, :position)
assert_equal 1, mechanisms.send(:position)

mechanisms = Positioning::Mechanisms.new(item2, :position)
assert_equal 2, mechanisms.send(:position)
end

def test_position=
list = List.create name: "List"
student = list.authors.create name: "Student", type: "Author::Student"
Expand Down

0 comments on commit 61c3a52

Please sign in to comment.