~ubuntu-branches/ubuntu/vivid/ruby-sequel/vivid

« back to all changes in this revision

Viewing changes to spec/extensions/query_literals_spec.rb

  • Committer: Package Import Robot
  • Author(s): Dmitry Borodaenko, Dmitry Borodaenko, Cédric Boutillier
  • Date: 2013-08-10 18:38:17 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20130810183817-iqanz804j32i5myi
Tags: 4.1.1-1
[ Dmitry Borodaenko ]
* New upstream release.
* Standards-Version upgraded to 3.9.4 (no changes).
* Added Build-Depend on ruby-sqlite3.

[ Cédric Boutillier ]
* debian/control: remove obsolete DM-Upload-Allowed flag.
* use canonical URI in Vcs-* fields.
* debian/copyright: use DEP5 copyright-format/1.0 official URL for Format
  field.
* Update debian/watch. Thanks Bart Martens.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
describe "query_literals extension" do
4
4
  before do
5
 
    @ds = Sequel::Dataset.new(nil).from(:t).extension(:query_literals)
 
5
    @ds = Sequel.mock.dataset.from(:t).extension(:query_literals)
6
6
  end
7
7
 
8
8
  it "should not use special support if given a block" do
18
18
  end
19
19
 
20
20
  it "should have #select work the standard way if initial string is a literal string already" do
21
 
    @ds.select('a, b, ?'.lit, 1).sql.should == 'SELECT a, b, ?, 1 FROM t'
 
21
    @ds.select(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT a, b, ?, 1 FROM t'
22
22
  end
23
23
 
24
24
  it "should have #select work regularly if not given a string as the first argument" do
34
34
      @ds.select_more('a, b, c').sql.should == 'SELECT d, a, b, c FROM t'
35
35
    end
36
36
 
37
 
    it "should have #select_ use placeholder literal string if given a string and additional arguments" do
 
37
    it "should have #select_more use placeholder literal string if given a string and additional arguments" do
38
38
      @ds.select_more('a, b, ?', 1).sql.should == 'SELECT d, a, b, 1 FROM t'
39
39
    end
40
40
 
41
41
    it "should have #select_more work the standard way if initial string is a literal string already" do
42
 
      @ds.select_more('a, b, ?'.lit, 1).sql.should == 'SELECT d, a, b, ?, 1 FROM t'
 
42
      @ds.select_more(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT d, a, b, ?, 1 FROM t'
43
43
    end
44
44
 
45
45
    it "should have #select_more work regularly if not given a string as the first argument" do
56
56
  end
57
57
 
58
58
  it "should have #select_append work the standard way if initial string is a literal string already" do
59
 
    @ds.select_append('a, b, ?'.lit, 1).sql.should == 'SELECT *, a, b, ?, 1 FROM t'
 
59
    @ds.select_append(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT *, a, b, ?, 1 FROM t'
60
60
  end
61
61
 
62
62
  it "should have #select_append work regularly if not given a string as the first argument" do
72
72
  end
73
73
 
74
74
  it "should have #select_group work the standard way if initial string is a literal string already" do
75
 
    @ds.select_group('a, b, ?'.lit, 1).sql.should == 'SELECT a, b, ?, 1 FROM t GROUP BY a, b, ?, 1'
 
75
    @ds.select_group(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT a, b, ?, 1 FROM t GROUP BY a, b, ?, 1'
76
76
  end
77
77
 
78
78
  it "should have #select_group work regularly if not given a string as the first argument" do
87
87
    @ds.group('a, b, ?', 1).sql.should == 'SELECT * FROM t GROUP BY a, b, 1'
88
88
  end
89
89
 
90
 
  it "should have #select_group work the standard way if initial string is a literal string already" do
91
 
    @ds.group('a, b, ?'.lit, 1).sql.should == 'SELECT * FROM t GROUP BY a, b, ?, 1'
 
90
  it "should have #group work the standard way if initial string is a literal string already" do
 
91
    @ds.group(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT * FROM t GROUP BY a, b, ?, 1'
92
92
  end
93
93
 
94
 
  it "should have #select_group work regularly if not given a string as the first argument" do
 
94
  it "should have #group work regularly if not given a string as the first argument" do
95
95
    @ds.group(:a, 1).sql.should == 'SELECT * FROM t GROUP BY a, 1'
96
96
  end
97
97
 
104
104
  end
105
105
 
106
106
  it "should have #group_and_count work the standard way if initial string is a literal string already" do
107
 
    @ds.group_and_count('a, b, ?'.lit, 1).sql.should == 'SELECT a, b, ?, 1, count(*) AS count FROM t GROUP BY a, b, ?, 1'
 
107
    @ds.group_and_count(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT a, b, ?, 1, count(*) AS count FROM t GROUP BY a, b, ?, 1'
108
108
  end
109
109
 
110
110
  it "should have #group_and_count work regularly if not given a string as the first argument" do
120
120
  end
121
121
 
122
122
  it "should have #order work the standard way if initial string is a literal string already" do
123
 
    @ds.order('a, b, ?'.lit, 1).sql.should == 'SELECT * FROM t ORDER BY a, b, ?, 1'
 
123
    @ds.order(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT * FROM t ORDER BY a, b, ?, 1'
124
124
  end
125
125
 
126
126
  it "should have #order work regularly if not given a string as the first argument" do
141
141
    end
142
142
 
143
143
    it "should have #order_more work the standard way if initial string is a literal string already" do
144
 
      @ds.order_more('a, b, ?'.lit, 1).sql.should == 'SELECT * FROM t ORDER BY d, a, b, ?, 1'
 
144
      @ds.order_more(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT * FROM t ORDER BY d, a, b, ?, 1'
145
145
    end
146
146
 
147
147
    it "should have #order_more work regularly if not given a string as the first argument" do
157
157
    end
158
158
 
159
159
    it "should have #order_append work the standard way if initial string is a literal string already" do
160
 
      @ds.order_prepend('a, b, ?'.lit, 1).sql.should == 'SELECT * FROM t ORDER BY a, b, ?, 1, d'
 
160
      @ds.order_prepend(Sequel.lit('a, b, ?'), 1).sql.should == 'SELECT * FROM t ORDER BY a, b, ?, 1, d'
161
161
    end
162
162
 
163
163
    it "should have #order_append work regularly if not given a string as the first argument" do