spec/mysql2/client_spec.rb in mysql2-cs-bind-0.1.0 vs spec/mysql2/client_spec.rb in mysql2-cs-bind-0.1.1

- old
+ new

@@ -19,11 +19,11 @@ it "should return replaced query if with placeholders" do @klass.pseudo_bind("SELECT x,y,z FROM x WHERE x=?", [1]).should eql("SELECT x,y,z FROM x WHERE x='1'") @klass.pseudo_bind("SELECT x,y,z FROM x WHERE x=? AND y=?", [1, 'X']).should eql("SELECT x,y,z FROM x WHERE x='1' AND y='X'") end - + it "should raise ArgumentError if mismatch exists between placeholders and arguments" do expect { @klass.pseudo_bind("SELECT x,y,z FROM x", [1]) }.should raise_exception(ArgumentError) expect { @@ -69,27 +69,20 @@ expect { @client.xquery("SELECT 1 UNION SELECT ?", 2, :stream => true, :cache_rows => false) }.to_not raise_exception(Mysql2::Error) end - it "should accept an options hash that inherits from Mysql2::Client.default_query_options" do - @client.xquery "SELECT ?", 1, :something => :else - @client.query_options.should eql(@client.query_options.merge(:something => :else)) - end - it "should return results as a hash by default" do @client.xquery("SELECT ?", 1).first.class.should eql(Hash) end it "should be able to return results as an array" do @client.xquery("SELECT ?", 1, :as => :array).first.class.should eql(Array) - @client.xquery("SELECT ?", 1).each(:as => :array) - @client.query("SELECT 1").first.should eql([1]) - @client.query("SELECT '1'").first.should eql(['1']) + @client.xquery("SELECT ?", 1).each(:as => :array).first.class.should eql(Array) @client.xquery("SELECT 1", :as => :array).first.should eql([1]) - @client.xquery("SELECT ?", 1).first.should eql(['1']) - @client.xquery("SELECT ?+1", 1).first.should eql([2.0]) + @client.xquery("SELECT ?", 1, :as => :array).first.should eql(['1']) + @client.xquery("SELECT ?+1", 1, :as => :array).first.should eql([2.0]) end it "should read multi style args" do @client.xquery("SELECT id FROM (SELECT 1 AS id) AS tbl WHERE id IN (1)").first["id"].should eql(1) @@ -124,13 +117,7 @@ end end it "should respond to escape" do Mysql2::Client.should respond_to(:escape) - end - - if RUBY_VERSION =~ /1.9/ - it "should respond to #encoding" do - @client.should respond_to(:encoding) - end end end