sequel_core 1.0.8.1 → 1.0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ include FileUtils
9
9
  # Configuration
10
10
  ##############################################################################
11
11
  NAME = "sequel_core"
12
- VERS = "1.0.8.1"
12
+ VERS = "1.0.8.2"
13
13
  CLEAN.include ["**/.*.sw?", "pkg/*", ".config", "doc/*", "coverage/*"]
14
14
  RDOC_OPTS = [
15
15
  "--quiet",
@@ -413,4 +413,3 @@ context "A grouped MySQL dataset" do
413
413
  ds.count.should == 1
414
414
  end
415
415
  end
416
-
@@ -507,6 +507,38 @@ context "Proc#to_sql" do
507
507
  @criteria = nil
508
508
  proc {if @criteria; :x.like @criteria; else; :x.like 'ddd'; end}.sql.should == "(x LIKE 'ddd')"
509
509
  end
510
+
511
+ specify "should support more complex conditional filters" do
512
+ x, y = true, false
513
+ proc {
514
+ if x || y
515
+ :a.like 'a'
516
+ else
517
+ :b.like 'b'
518
+ end
519
+ }.sql.should == "(a LIKE 'a')"
520
+
521
+ proc {
522
+ if y
523
+ :a.like 'a'
524
+ elsif x
525
+ :b.like 'b'
526
+ else
527
+ :c.like 'c'
528
+ end
529
+ }.sql.should == "(b LIKE 'b')"
530
+
531
+ @title = 'blah'
532
+ use_title = true
533
+
534
+ proc {
535
+ if !@title.blank? && use_title
536
+ :title.like "%#{@title}%"
537
+ end
538
+ }.sql.should == "(title LIKE '%blah%')"
539
+
540
+
541
+ end
510
542
  end
511
543
 
512
544
  context "Proc#to_sql stock" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8.1
4
+ version: 1.0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-08 00:00:00 +02:00
12
+ date: 2008-02-09 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency