test/unit/relation_spy_tests.rb in ardb-0.15.0 vs test/unit/relation_spy_tests.rb in ardb-0.16.0
- old
+ new
@@ -10,20 +10,23 @@
end
subject{ @relation_spy }
should have_readers :applied
should have_accessors :results
+ should have_accessors :order_values, :reverse_order_value
+ should have_accessors :limit_value, :offset_value
should have_imeths :select, :joins, :where, :order, :group, :having, :merge
should have_imeths :limit, :offset
should have_imeths :all, :count
- should have_imeths :limit_value, :offset_value
should "default it's attributes" do
assert_equal [], subject.applied
assert_equal [], subject.results
+ assert_equal [], subject.order_values
+ assert_equal nil, subject.reverse_order_value
assert_equal nil, subject.limit_value
- assert_equal 0, subject.offset_value
+ assert_equal nil, subject.offset_value
end
should "add an applied expression using `select`" do
subject.select :column_a, :column_b
assert_equal 1, subject.applied.size
@@ -56,9 +59,15 @@
assert_equal 1, subject.applied.size
applied_expression = subject.applied.first
assert_instance_of AppliedExpression, applied_expression
assert_equal :order, applied_expression.type
assert_equal [ :column_a, :column_b ], applied_expression.args
+ end
+
+ should "add args to it's `order_values` using `order" do
+ subject.order :column_a, :column_b
+ assert_includes :column_a, subject.order_values
+ assert_includes :column_b, subject.order_values
end
should "add an applied expression using `group`" do
subject.group :column_a, :column_b
assert_equal 1, subject.applied.size