diff --git a/test/cases/base_test.rb b/test/cases/base_test.rb index 3689b4234d..cd6fd18cbe 100644 --- a/test/cases/base_test.rb +++ b/test/cases/base_test.rb @@ -776,7 +776,11 @@ def test_collection_path def test_collection_path_with_parameters assert_equal "/people.json?gender=male", Person.collection_path(gender: "male") assert_equal "/people.json?gender=false", Person.collection_path(gender: false) - assert_equal "/people.json?gender=", Person.collection_path(gender: nil) + if ActiveSupport::VERSION::MAJOR < 8 || ActiveSupport::VERSION::MINOR < 1 + assert_equal "/people.json?gender=", Person.collection_path(gender: nil) + else + assert_equal "/people.json?gender", Person.collection_path(gender: nil) + end assert_equal "/people.json?gender=male", Person.collection_path("gender" => "male") @@ -785,7 +789,11 @@ def test_collection_path_with_parameters assert Person.collection_path(gender: "male", student: true).include?("gender=male") assert Person.collection_path(gender: "male", student: true).include?("student=true") - assert_equal "/people.json?name%5B%5D=bob&name%5B%5D=your+uncle%2Bme&name%5B%5D=&name%5B%5D=false", Person.collection_path(name: ["bob", "your uncle+me", nil, false]) + if ActiveSupport::VERSION::MAJOR < 8 || ActiveSupport::VERSION::MINOR < 1 + assert_equal "/people.json?name%5B%5D=bob&name%5B%5D=your+uncle%2Bme&name%5B%5D=&name%5B%5D=false", Person.collection_path(name: ["bob", "your uncle+me", nil, false]) + else + assert_equal "/people.json?name%5B%5D=bob&name%5B%5D=your+uncle%2Bme&name%5B%5D&name%5B%5D=false", Person.collection_path(name: ["bob", "your uncle+me", nil, false]) + end assert_equal "/people.json?struct%5Ba%5D%5B%5D=2&struct%5Ba%5D%5B%5D=1&struct%5Bb%5D=fred", Person.collection_path(struct: { :a => [2, 1], "b" => "fred" }) end diff --git a/test/singleton_test.rb b/test/singleton_test.rb index fd8a3bbaee..64acc55c87 100644 --- a/test/singleton_test.rb +++ b/test/singleton_test.rb @@ -41,7 +41,11 @@ def test_singleton_path def test_singleton_path_with_parameters assert_equal "/weather.json?degrees=fahrenheit", Weather.singleton_path(degrees: "fahrenheit") assert_equal "/weather.json?degrees=false", Weather.singleton_path(degrees: false) - assert_equal "/weather.json?degrees=", Weather.singleton_path(degrees: nil) + if ActiveSupport::VERSION::MAJOR < 8 || ActiveSupport::VERSION::MINOR < 1 + assert_equal "/weather.json?degrees=", Weather.singleton_path(degrees: nil) + else + assert_equal "/weather.json?degrees", Weather.singleton_path(degrees: nil) + end assert_equal "/weather.json?degrees=fahrenheit", Weather.singleton_path("degrees" => "fahrenheit") @@ -52,7 +56,11 @@ def test_singleton_path_with_parameters assert path.include?("lunar=true") path = Weather.singleton_path(days: ["monday", "saturday and sunday", nil, false]) - assert_equal "/weather.json?days%5B%5D=monday&days%5B%5D=saturday+and+sunday&days%5B%5D=&days%5B%5D=false", path + if ActiveSupport::VERSION::MAJOR < 8 || ActiveSupport::VERSION::MINOR < 1 + assert_equal "/weather.json?days%5B%5D=monday&days%5B%5D=saturday+and+sunday&days%5B%5D=&days%5B%5D=false", path + else + assert_equal "/weather.json?days%5B%5D=monday&days%5B%5D=saturday+and+sunday&days%5B%5D&days%5B%5D=false", path + end path = Inventory.singleton_path(product_id: 5) assert_equal "/products/5/inventory.json", path