Sha256: b205304bdf4448ff6746e6b2d9cc90ebc061edef73af628941077297e26c1a47
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe SQLTree::Node::UpdateQuery do it "should parse an UPDATE query without WHERE clause correctly" do update = SQLTree::Node::UpdateQuery["UPDATE table SET field1 = 1, field2 = 5 - 3"] update.table.should == SQLTree::Node::TableReference.new("table") update.updates.should have(2).items update.updates[0].field.should == SQLTree::Node::Expression::Field.new("field1") update.updates[0].expression.should == SQLTree::Node::Expression::Value.new(1) update.updates[1].field.should == SQLTree::Node::Expression::Field.new("field2") update.updates[1].expression.should be_kind_of(SQLTree::Node::Expression) update.where.should be_nil end it "should parse an UPDATE query with WHERE clause correctly" do update = SQLTree::Node::UpdateQuery["UPDATE table SET field = 1 WHERE id = 17"] update.table.should == SQLTree::Node::TableReference.new("table") update.updates.should have(1).item update.where.should be_kind_of(SQLTree::Node::Expression) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sql_tree-0.2.0 | spec/unit/update_query_spec.rb |