DEV: improve test_query_decorator (#16)

DEV: improve test_query_decorator (#16)

  • improve test_query_decorator

  • mysql

diff --git a/test/mini_sql/builder_tests.rb b/test/mini_sql/builder_tests.rb
index 6a1edc3..ab401ad 100644
--- a/test/mini_sql/builder_tests.rb
+++ b/test/mini_sql/builder_tests.rb
@@ -95,9 +95,10 @@ module MiniSql::BuilderTests
   end
 
   def test_query_decorator
-    builder = @connection.build("select 20 price, 3 quantity")
+    builder = @connection.build("select :price AS price, :quantity AS quantity /*where*/")
+    builder.where('1 = :one', one: 1)
 
-    r = builder.query_decorator(ProductDecorator).first
+    r = builder.query_decorator(ProductDecorator, price: 20, quantity: 3).first
     assert_equal(60, r.amount_price)
   end
 end
diff --git a/test/mini_sql/mysql/builder_test.rb b/test/mini_sql/mysql/builder_test.rb
index 2c65d20..a40a10f 100644
--- a/test/mini_sql/mysql/builder_test.rb
+++ b/test/mini_sql/mysql/builder_test.rb
@@ -95,4 +95,12 @@ class MiniSql::Mysql::TestBuilder < MiniTest::Test
 
     assert_equal([7, 8], @connection.query_single("select * from ta"))
   end
+
+  def test_query_decorator
+    builder = @connection.build("select :price AS price, :quantity AS quantity from for_testing /*where*/")
+    builder.where('1 = :one', one: 1)
+
+    r = builder.query_decorator(ProductDecorator, price: 20, quantity: 3).first
+    assert_equal(60, r.amount_price)
+  end
 end

GitHub sha: 2d23167e

This commit appears in #16 which was merged by SamSaffron.