Commit 761d594c399c56da9dbfac6e6b4781dbc48e9c17
1 parent
e05728dc
Exists in
master
Added test for mutating relation methods
Showing
1 changed file
with
7 additions
and
0 deletions
Show diff stats
test/relation_test.rb
@@ -16,6 +16,13 @@ class RelationTest < Minitest::Test | @@ -16,6 +16,13 @@ class RelationTest < Minitest::Test | ||
16 | assert_equal "Relation loaded", error.message | 16 | assert_equal "Relation loaded", error.message |
17 | end | 17 | end |
18 | 18 | ||
19 | + def test_mutating | ||
20 | + store_names ["Product A", "Product B"] | ||
21 | + products = Product.search("*").order(:name) | ||
22 | + products.limit!(1) | ||
23 | + assert_equal ["Product A"], products.map(&:name) | ||
24 | + end | ||
25 | + | ||
19 | def test_clone | 26 | def test_clone |
20 | products = Product.search("*") | 27 | products = Product.search("*") |
21 | assert_equal 10, products.limit(10).limit_value | 28 | assert_equal 10, products.limit(10).limit_value |