test/pluck_test.rb in hario-0.3.0 vs test/pluck_test.rb in hario-0.3.1
- old
+ new
@@ -14,6 +14,25 @@
products = Product.search(nil, ["name", "brand.name"])
assert_equal ["id", "name", "brands.name"], products.flat_map(&:keys).uniq,
"Pluck not returning correct attributes with association pluck"
end
-end
\ No newline at end of file
+
+ def test_hidden_column_pluck
+ assert_raises Hario::PluckParser::InvalidAttributeError do
+ Product.search(nil, %w( hidden_column ))
+ end
+ end
+
+ def test_hidden_column_pluck_with_join
+ assert_raises Hario::PluckParser::InvalidAttributeError do
+ Brand.search(nil, %w( products.hidden_column ))
+ end
+ end
+
+ def test_empty_string_ignored
+ Product.search(nil, [""])
+
+ # no exception
+ assert true
+ end
+end