ronin-sql 0.2.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +4 -0
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/.yardopts +1 -0
- data/COPYING.txt +623 -288
- data/{History.txt → ChangeLog.md} +33 -35
- data/Gemfile +25 -0
- data/README.md +110 -0
- data/Rakefile +30 -20
- data/bin/ronin-sql +18 -5
- data/gemspec.yml +16 -0
- data/lib/ronin/formatting/extensions/sql.rb +4 -3
- data/lib/ronin/formatting/extensions/sql/string.rb +83 -10
- data/lib/ronin/formatting/sql.rb +4 -3
- data/lib/ronin/sql.rb +5 -12
- data/lib/ronin/{code/sql/create_index.rb → sql/binary_expr.rb} +25 -18
- data/lib/ronin/sql/clause.rb +72 -0
- data/lib/ronin/sql/clauses.rb +297 -0
- data/lib/ronin/sql/emittable.rb +84 -0
- data/lib/ronin/sql/emitter.rb +375 -0
- data/lib/ronin/sql/field.rb +106 -0
- data/lib/ronin/{code/sql/as.rb → sql/fields.rb} +36 -17
- data/lib/ronin/{code/sql/binary_expr.rb → sql/function.rb} +27 -27
- data/lib/ronin/sql/functions.rb +989 -0
- data/lib/ronin/sql/injection.rb +125 -157
- data/lib/ronin/{code/sql/default_values_clause.rb → sql/literal.rb} +13 -11
- data/lib/ronin/sql/literals.rb +72 -0
- data/lib/ronin/sql/operators.rb +332 -0
- data/lib/ronin/sql/sql.rb +86 -0
- data/lib/ronin/sql/statement.rb +70 -0
- data/lib/ronin/sql/statement_list.rb +110 -0
- data/lib/ronin/sql/statements.rb +115 -0
- data/lib/ronin/{code/sql/desc.rb → sql/unary_expr.rb} +11 -11
- data/lib/ronin/sql/version.rb +5 -4
- data/ronin-sql.gemspec +61 -0
- data/spec/formatting/sql/string_spec.rb +172 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/sql/binary_expr.rb +5 -0
- data/spec/sql/binary_expr_examples.rb +25 -0
- data/spec/sql/clause_examples.rb +43 -0
- data/spec/sql/clause_spec.rb +31 -0
- data/spec/sql/clauses_spec.rb +43 -0
- data/spec/sql/emittable_spec.rb +41 -0
- data/spec/sql/emitter_spec.rb +472 -0
- data/spec/sql/field_spec.rb +103 -0
- data/spec/sql/fields_spec.rb +40 -0
- data/spec/sql/function_examples.rb +30 -0
- data/spec/sql/function_spec.rb +25 -0
- data/spec/sql/functions_spec.rb +110 -0
- data/spec/sql/injection_spec.rb +233 -0
- data/spec/sql/literal_spec.rb +5 -0
- data/spec/sql/literals_spec.rb +46 -0
- data/spec/sql/operators_spec.rb +44 -0
- data/spec/sql/sql_spec.rb +18 -0
- data/spec/sql/statement_examples.rb +39 -0
- data/spec/sql/statement_list_spec.rb +48 -0
- data/spec/sql/statement_sql.rb +38 -0
- data/spec/sql/statements_spec.rb +22 -0
- data/spec/sql/unary_expr.rb +5 -0
- data/spec/sql/unary_expr_examples.rb +20 -0
- metadata +116 -217
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -108
- data/README.txt +0 -112
- data/lib/ronin/code/sql.rb +0 -22
- data/lib/ronin/code/sql/add_column_clause.rb +0 -42
- data/lib/ronin/code/sql/alter_table.rb +0 -52
- data/lib/ronin/code/sql/asc.rb +0 -36
- data/lib/ronin/code/sql/between.rb +0 -66
- data/lib/ronin/code/sql/clause.rb +0 -35
- data/lib/ronin/code/sql/code.rb +0 -35
- data/lib/ronin/code/sql/common_dialect.rb +0 -66
- data/lib/ronin/code/sql/create.rb +0 -74
- data/lib/ronin/code/sql/create_table.rb +0 -44
- data/lib/ronin/code/sql/create_view.rb +0 -41
- data/lib/ronin/code/sql/delete.rb +0 -52
- data/lib/ronin/code/sql/dialect.rb +0 -282
- data/lib/ronin/code/sql/drop.rb +0 -55
- data/lib/ronin/code/sql/drop_index.rb +0 -41
- data/lib/ronin/code/sql/drop_table.rb +0 -41
- data/lib/ronin/code/sql/drop_view.rb +0 -41
- data/lib/ronin/code/sql/emittable.rb +0 -100
- data/lib/ronin/code/sql/exceptions.rb +0 -24
- data/lib/ronin/code/sql/exceptions/unknown_clause.rb +0 -29
- data/lib/ronin/code/sql/exceptions/unknown_dialect.rb +0 -29
- data/lib/ronin/code/sql/exceptions/unknown_statement.rb +0 -29
- data/lib/ronin/code/sql/expr.rb +0 -102
- data/lib/ronin/code/sql/field.rb +0 -101
- data/lib/ronin/code/sql/fields_clause.rb +0 -46
- data/lib/ronin/code/sql/from_clause.rb +0 -42
- data/lib/ronin/code/sql/function.rb +0 -53
- data/lib/ronin/code/sql/group_by_clause.rb +0 -46
- data/lib/ronin/code/sql/having_clause.rb +0 -46
- data/lib/ronin/code/sql/in.rb +0 -47
- data/lib/ronin/code/sql/injected_statement.rb +0 -100
- data/lib/ronin/code/sql/injection.rb +0 -203
- data/lib/ronin/code/sql/insert.rb +0 -54
- data/lib/ronin/code/sql/intersect_clause.rb +0 -42
- data/lib/ronin/code/sql/join_clause.rb +0 -123
- data/lib/ronin/code/sql/like.rb +0 -73
- data/lib/ronin/code/sql/limit_clause.rb +0 -42
- data/lib/ronin/code/sql/modifier.rb +0 -48
- data/lib/ronin/code/sql/offset_clause.rb +0 -42
- data/lib/ronin/code/sql/on_clause.rb +0 -55
- data/lib/ronin/code/sql/order_by_clause.rb +0 -42
- data/lib/ronin/code/sql/program.rb +0 -225
- data/lib/ronin/code/sql/rename_to_clause.rb +0 -42
- data/lib/ronin/code/sql/replace.rb +0 -54
- data/lib/ronin/code/sql/select.rb +0 -103
- data/lib/ronin/code/sql/set_clause.rb +0 -42
- data/lib/ronin/code/sql/statement.rb +0 -180
- data/lib/ronin/code/sql/token.rb +0 -62
- data/lib/ronin/code/sql/unary_expr.rb +0 -47
- data/lib/ronin/code/sql/union_all_clause.rb +0 -42
- data/lib/ronin/code/sql/union_clause.rb +0 -42
- data/lib/ronin/code/sql/update.rb +0 -52
- data/lib/ronin/code/sql/values_clause.rb +0 -46
- data/lib/ronin/code/sql/where_clause.rb +0 -42
- data/lib/ronin/sql/error.rb +0 -26
- data/lib/ronin/sql/error/error.rb +0 -62
- data/lib/ronin/sql/error/extensions.rb +0 -22
- data/lib/ronin/sql/error/extensions/string.rb +0 -77
- data/lib/ronin/sql/error/message.rb +0 -62
- data/lib/ronin/sql/error/pattern.rb +0 -104
- data/lib/ronin/sql/error/patterns.rb +0 -99
- data/lib/ronin/sql/extensions.rb +0 -22
- data/lib/ronin/sql/extensions/uri.rb +0 -22
- data/lib/ronin/sql/extensions/uri/http.rb +0 -107
- data/spec/code/sql/common_dialect_spec.rb +0 -205
- data/spec/code/sql/create_examples.rb +0 -19
- data/spec/code/sql/create_index_spec.rb +0 -25
- data/spec/code/sql/create_table_spec.rb +0 -27
- data/spec/code/sql/create_view_spec.rb +0 -16
- data/spec/code/sql/delete_spec.rb +0 -14
- data/spec/code/sql/drop_examples.rb +0 -10
- data/spec/code/sql/drop_index_spec.rb +0 -16
- data/spec/code/sql/drop_table_spec.rb +0 -16
- data/spec/code/sql/drop_view_spec.rb +0 -16
- data/spec/code/sql/has_default_values_clause_examples.rb +0 -10
- data/spec/code/sql/has_fields_clause_examples.rb +0 -15
- data/spec/code/sql/has_from_clause_examples.rb +0 -13
- data/spec/code/sql/has_values_clause_examples.rb +0 -15
- data/spec/code/sql/has_where_clause_examples.rb +0 -15
- data/spec/code/sql/insert_spec.rb +0 -21
- data/spec/code/sql/replace_spec.rb +0 -21
- data/spec/code/sql/select_spec.rb +0 -105
- data/spec/code/sql/update_spec.rb +0 -26
- data/spec/helpers/code.rb +0 -14
- data/spec/sql/error_spec.rb +0 -24
- data/spec/sql/extensions/uri/http_spec.rb +0 -34
- data/spec/sql_spec.rb +0 -9
- data/tasks/spec.rb +0 -10
- data/tasks/yard.rb +0 -13
- metadata.gz.sig +0 -0
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/create'
|
2
|
-
|
3
|
-
require 'code/sql/has_fields_clause_examples'
|
4
|
-
|
5
|
-
require 'helpers/code'
|
6
|
-
|
7
|
-
shared_examples_for "Create" do
|
8
|
-
it_should_behave_like "has a fields clause"
|
9
|
-
|
10
|
-
it "should have a temp option" do
|
11
|
-
@sql.temp!
|
12
|
-
@sql.should be_temp
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should have a if_not_exists option" do
|
16
|
-
@sql.if_not_exists!
|
17
|
-
@sql.should be_if_not_exists
|
18
|
-
end
|
19
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/create_index'
|
2
|
-
|
3
|
-
require 'code/sql/create_examples'
|
4
|
-
|
5
|
-
describe CreateIndex do
|
6
|
-
before(:each) do
|
7
|
-
@sql = CreateIndex.new(common_dialect)
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like "Create"
|
11
|
-
|
12
|
-
it "should have an on clause" do
|
13
|
-
@sql.on :users, [:name]
|
14
|
-
|
15
|
-
should_have_clause(@sql,:on) do |on|
|
16
|
-
on.table.should == :users
|
17
|
-
on.fields.should == [:name]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have an index option" do
|
22
|
-
@sql.index :users
|
23
|
-
@sql.instance_variable_get('@name').should == :users
|
24
|
-
end
|
25
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/create_table'
|
2
|
-
require 'ronin/code/sql/program'
|
3
|
-
|
4
|
-
require 'code/sql/create_examples'
|
5
|
-
|
6
|
-
describe CreateTable do
|
7
|
-
before(:each) do
|
8
|
-
@sql = CreateTable.new(common_dialect)
|
9
|
-
end
|
10
|
-
|
11
|
-
it_should_behave_like "Create"
|
12
|
-
|
13
|
-
it "should have a columns clause" do
|
14
|
-
columns = [:id, :name, :users]
|
15
|
-
|
16
|
-
@sql.columns(*columns)
|
17
|
-
|
18
|
-
should_have_clause(@sql,:columns) do |clause|
|
19
|
-
clause.fields.should == columns
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should have a table option" do
|
24
|
-
@sql.table :users
|
25
|
-
@sql.instance_variable_get('@name').should == :users
|
26
|
-
end
|
27
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/create_view'
|
2
|
-
|
3
|
-
require 'code/sql/create_examples'
|
4
|
-
|
5
|
-
describe CreateView do
|
6
|
-
before(:each) do
|
7
|
-
@sql = CreateView.new(common_dialect)
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like "Create"
|
11
|
-
|
12
|
-
it "should have a view option" do
|
13
|
-
@sql.view :users
|
14
|
-
@sql.instance_variable_get('@name').should == :users
|
15
|
-
end
|
16
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/delete'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
require 'code/sql/has_from_clause_examples'
|
5
|
-
require 'code/sql/has_where_clause_examples'
|
6
|
-
|
7
|
-
describe Delete do
|
8
|
-
before(:each) do
|
9
|
-
@sql = Delete.new(common_dialect)
|
10
|
-
end
|
11
|
-
|
12
|
-
it_should_behave_like "has a from clause"
|
13
|
-
it_should_behave_like "has a where clause"
|
14
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/drop_index'
|
2
|
-
|
3
|
-
require 'code/sql/drop_examples'
|
4
|
-
|
5
|
-
describe DropIndex do
|
6
|
-
before(:each) do
|
7
|
-
@sql = DropIndex.new(common_dialect)
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like "Drop"
|
11
|
-
|
12
|
-
it "should have a table option" do
|
13
|
-
@sql.index :users
|
14
|
-
@sql.instance_variable_get('@name').should == :users
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/drop_table'
|
2
|
-
|
3
|
-
require 'code/sql/drop_examples'
|
4
|
-
|
5
|
-
describe DropTable do
|
6
|
-
before(:each) do
|
7
|
-
@sql = DropTable.new(common_dialect)
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like "Drop"
|
11
|
-
|
12
|
-
it "should have a table option" do
|
13
|
-
@sql.table :users
|
14
|
-
@sql.instance_variable_get('@name').should == :users
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/drop_view'
|
2
|
-
|
3
|
-
require 'code/sql/drop_examples'
|
4
|
-
|
5
|
-
describe DropView do
|
6
|
-
before(:each) do
|
7
|
-
@sql = DropView.new(common_dialect)
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like "Drop"
|
11
|
-
|
12
|
-
it "should have a table option" do
|
13
|
-
@sql.view :users
|
14
|
-
@sql.instance_variable_get('@name').should == :users
|
15
|
-
end
|
16
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/default_values_clause'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
|
5
|
-
shared_examples_for "has a default values clause" do
|
6
|
-
it "should have a default values clause" do
|
7
|
-
@sql.default_values
|
8
|
-
@sql.has_clause?(:default_values).should == true
|
9
|
-
end
|
10
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/fields_clause'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
|
5
|
-
shared_examples_for "has a fields clause" do
|
6
|
-
it "should have a fields clause" do
|
7
|
-
fields = [:id, :name, :users]
|
8
|
-
|
9
|
-
@sql.fields(*fields)
|
10
|
-
|
11
|
-
should_have_clause(@sql,:fields) do |clause|
|
12
|
-
clause.fields.should == fields
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/from_clause'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
|
5
|
-
shared_examples_for "has a from clause" do
|
6
|
-
it "should have a from clause" do
|
7
|
-
@sql.from :users
|
8
|
-
|
9
|
-
should_have_clause(@sql,:from) do |from|
|
10
|
-
from.table.should == :users
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/values_clause'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
|
5
|
-
shared_examples_for "has a values clause" do
|
6
|
-
it "should have a values clause" do
|
7
|
-
values = [1,'bob','secret']
|
8
|
-
|
9
|
-
@sql.values(*values)
|
10
|
-
|
11
|
-
should_have_clause(@sql,:values) do |clause|
|
12
|
-
clause.values.should == values
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/where_clause'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
|
5
|
-
shared_examples_for "has a where clause" do
|
6
|
-
it "should have a where clause" do
|
7
|
-
@sql.instance_eval do
|
8
|
-
where name == 'bob'
|
9
|
-
end
|
10
|
-
|
11
|
-
should_have_clause(@sql,:where) do |clause|
|
12
|
-
clause.expr.should_not be_nil
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/insert'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
require 'code/sql/has_fields_clause_examples'
|
5
|
-
require 'code/sql/has_default_values_clause_examples'
|
6
|
-
require 'code/sql/has_values_clause_examples'
|
7
|
-
|
8
|
-
describe Insert do
|
9
|
-
before(:each) do
|
10
|
-
@sql = Insert.new(common_dialect)
|
11
|
-
end
|
12
|
-
|
13
|
-
it_should_behave_like "has a fields clause"
|
14
|
-
it_should_behave_like "has a default values clause"
|
15
|
-
it_should_behave_like "has a values clause"
|
16
|
-
|
17
|
-
it "should have a table option" do
|
18
|
-
@sql.table :users
|
19
|
-
@sql.instance_variable_get('@table').should == :users
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/replace'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
require 'code/sql/has_fields_clause_examples'
|
5
|
-
require 'code/sql/has_default_values_clause_examples'
|
6
|
-
require 'code/sql/has_values_clause_examples'
|
7
|
-
|
8
|
-
describe Replace do
|
9
|
-
before(:each) do
|
10
|
-
@sql = Replace.new(common_dialect)
|
11
|
-
end
|
12
|
-
|
13
|
-
it_should_behave_like 'has a fields clause'
|
14
|
-
it_should_behave_like 'has a default values clause'
|
15
|
-
it_should_behave_like 'has a values clause'
|
16
|
-
|
17
|
-
it "should have a table option" do
|
18
|
-
@sql.table :users
|
19
|
-
@sql.instance_variable_get('@table').should == :users
|
20
|
-
end
|
21
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/select'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
require 'code/sql/has_from_clause_examples'
|
5
|
-
require 'code/sql/has_where_clause_examples'
|
6
|
-
|
7
|
-
describe Select do
|
8
|
-
before(:each) do
|
9
|
-
@sql = Select.new(common_dialect)
|
10
|
-
end
|
11
|
-
|
12
|
-
it_should_behave_like "has a fields clause"
|
13
|
-
it_should_behave_like "has a from clause"
|
14
|
-
it_should_behave_like "has a where clause"
|
15
|
-
|
16
|
-
it "should have a join clause" do
|
17
|
-
@sql.join :users, :inner => true, :left => true
|
18
|
-
|
19
|
-
should_have_clause(@sql,:join) do |join|
|
20
|
-
join.table.should == :users
|
21
|
-
join.side.should == :inner
|
22
|
-
join.direction.should == :left
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should have a group by clause" do
|
27
|
-
fields = [:name, :age]
|
28
|
-
|
29
|
-
@sql.group_by(*fields)
|
30
|
-
|
31
|
-
should_have_clause(@sql,:group_by) do |group_by|
|
32
|
-
group_by.fields.should == fields
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should have a having clause" do
|
37
|
-
@sql.instance_eval do
|
38
|
-
having name == 'bob'
|
39
|
-
end
|
40
|
-
|
41
|
-
should_have_clause(@sql,:having) do |clause|
|
42
|
-
clause.expr.should_not be_nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should have a order by clause" do
|
47
|
-
fields = [:name, :age]
|
48
|
-
|
49
|
-
@sql.order_by(*fields)
|
50
|
-
|
51
|
-
should_have_clause(@sql,:order_by) do |clause|
|
52
|
-
clause.fields.should == fields
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should have a limit clause" do
|
57
|
-
length = 10
|
58
|
-
|
59
|
-
@sql.limit length
|
60
|
-
|
61
|
-
should_have_clause(@sql,:limit) do |clause|
|
62
|
-
clause.value.should == length
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should have a limit clause" do
|
67
|
-
index = 100
|
68
|
-
|
69
|
-
@sql.offset index
|
70
|
-
|
71
|
-
should_have_clause(@sql,:offset) do |clause|
|
72
|
-
clause.value.should == index
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should have a union clause" do
|
77
|
-
query = 'SELECT * FROM admins'
|
78
|
-
|
79
|
-
@sql.union query
|
80
|
-
|
81
|
-
should_have_clause(@sql,:union) do |clause|
|
82
|
-
clause.select.should == query
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should have a union all clause" do
|
87
|
-
query = 'SELECT * FROM admins'
|
88
|
-
|
89
|
-
@sql.union_all query
|
90
|
-
|
91
|
-
should_have_clause(@sql,:union_all) do |clause|
|
92
|
-
clause.select.should == query
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should have an all rows option" do
|
97
|
-
@sql.all_rows!
|
98
|
-
@sql.should be_all_rows
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should have an distinct rows option" do
|
102
|
-
@sql.distinct_rows!
|
103
|
-
@sql.should be_distinct_rows
|
104
|
-
end
|
105
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'ronin/code/sql/update'
|
2
|
-
|
3
|
-
require 'helpers/code'
|
4
|
-
require 'code/sql/has_where_clause_examples'
|
5
|
-
|
6
|
-
describe Update do
|
7
|
-
before(:each) do
|
8
|
-
@sql = Update.new(common_dialect)
|
9
|
-
end
|
10
|
-
|
11
|
-
it_should_behave_like "has a where clause"
|
12
|
-
|
13
|
-
it "should have a set clause" do
|
14
|
-
values = [1, 'bob', 25]
|
15
|
-
@sql.set(*values)
|
16
|
-
|
17
|
-
should_have_clause(@sql,:set) do |clause|
|
18
|
-
clause.values.should == values
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should have a table option" do
|
23
|
-
@sql.table :users
|
24
|
-
@sql.instance_variable_get('@table').should == :users
|
25
|
-
end
|
26
|
-
end
|
data/spec/helpers/code.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require 'ronin/code/sql/common_dialect'
|
4
|
-
|
5
|
-
include Code::SQL
|
6
|
-
|
7
|
-
def common_dialect
|
8
|
-
Dialect.get(:common).new
|
9
|
-
end
|
10
|
-
|
11
|
-
def should_have_clause(sql,name,&block)
|
12
|
-
sql.has_clause?(name).should == true
|
13
|
-
block.call(sql.get_clause(name)) if block
|
14
|
-
end
|