itrigga-param_fu 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -41,7 +41,7 @@ module Trigga
41
41
  condition[:values] = val.to_i
42
42
  else
43
43
  condition[:where] = "#{table}.name LIKE ?"
44
- condition[:values] = "#{'%' + val.gsub(/\(\d+\)/,"") + '%'}"
44
+ condition[:values] = "#{'%' + val.gsub(/\s*\(\d+\)/,"") + '%'}"
45
45
  end
46
46
  end
47
47
  condition
@@ -123,6 +123,16 @@ describe ::Trigga::ParamFu do
123
123
  it "should include the given value in values, wrapped in wildcard markers" do
124
124
  Tester.id_or_name_condition('mymodel', 'string_value')[:values].should == '%string_value%'
125
125
  end
126
+
127
+ context "and the value has an id in brackets on the end" do
128
+ it "should strip the brackets and value" do
129
+ Tester.id_or_name_condition('mymodel', 'string_value (1234)')[:values].should_not =~ /\([0-9]*\)/
130
+ end
131
+
132
+ it "should strip any space before the brackets" do
133
+ Tester.id_or_name_condition('mymodel', 'string_value (1234)')[:values].should == "%string_value%"
134
+ end
135
+ end
126
136
  end
127
137
  context "when given an integer value" do
128
138
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itrigga-param_fu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Al Davidson