datagrid 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -6
  3. data/VERSION +1 -1
  4. data/app/views/datagrid/_form.html.erb +3 -1
  5. data/datagrid.gemspec +6 -6
  6. data/lib/datagrid.rb +1 -0
  7. data/lib/datagrid/columns.rb +14 -7
  8. data/lib/datagrid/columns/column.rb +7 -4
  9. data/lib/datagrid/renderer.rb +1 -1
  10. data/spec/datagrid/active_model_spec.rb +4 -4
  11. data/spec/datagrid/column_names_attribute_spec.rb +15 -11
  12. data/spec/datagrid/columns_spec.rb +80 -62
  13. data/spec/datagrid/core_spec.rb +6 -6
  14. data/spec/datagrid/drivers/active_record_spec.rb +4 -4
  15. data/spec/datagrid/drivers/array_spec.rb +41 -8
  16. data/spec/datagrid/drivers/mongo_mapper_spec.rb +42 -10
  17. data/spec/datagrid/drivers/mongoid_spec.rb +43 -11
  18. data/spec/datagrid/filters/composite_filters_spec.rb +12 -12
  19. data/spec/datagrid/filters/date_filter_spec.rb +25 -25
  20. data/spec/datagrid/filters/date_time_filter_spec.rb +20 -20
  21. data/spec/datagrid/filters/dynamic_filter_spec.rb +43 -43
  22. data/spec/datagrid/filters/enum_filter_spec.rb +6 -6
  23. data/spec/datagrid/filters/extended_boolean_filter_spec.rb +10 -10
  24. data/spec/datagrid/filters/float_filter_spec.rb +2 -2
  25. data/spec/datagrid/filters/integer_filter_spec.rb +34 -34
  26. data/spec/datagrid/filters/string_filter_spec.rb +7 -7
  27. data/spec/datagrid/filters_spec.rb +20 -20
  28. data/spec/datagrid/form_builder_spec.rb +5 -5
  29. data/spec/datagrid/helper_spec.rb +41 -40
  30. data/spec/datagrid/ordering_spec.rb +22 -22
  31. data/spec/datagrid/scaffold_spec.rb +2 -2
  32. data/spec/datagrid/utils_spec.rb +3 -3
  33. data/spec/datagrid_spec.rb +10 -7
  34. data/spec/support/matchers.rb +6 -3
  35. metadata +30 -30
@@ -44,9 +44,9 @@ describe Datagrid::Filters::DateTimeFilter do
44
44
  scope { Entry }
45
45
  filter(:created_at, :datetime, :range => true)
46
46
  end
47
- report.assets.should_not include(e1)
48
- report.assets.should include(e2)
49
- report.assets.should_not include(e3)
47
+ expect(report.assets).not_to include(e1)
48
+ expect(report.assets).to include(e2)
49
+ expect(report.assets).not_to include(e3)
50
50
  end
51
51
 
52
52
  it "should support minimum datetime argument" do
@@ -57,9 +57,9 @@ describe Datagrid::Filters::DateTimeFilter do
57
57
  scope { Entry }
58
58
  filter(:created_at, :datetime, :range => true)
59
59
  end
60
- report.assets.should_not include(e1)
61
- report.assets.should include(e2)
62
- report.assets.should include(e3)
60
+ expect(report.assets).not_to include(e1)
61
+ expect(report.assets).to include(e2)
62
+ expect(report.assets).to include(e3)
63
63
  end
64
64
 
65
65
  it "should support maximum datetime argument" do
@@ -70,9 +70,9 @@ describe Datagrid::Filters::DateTimeFilter do
70
70
  scope { Entry }
71
71
  filter(:created_at, :datetime, :range => true)
72
72
  end
73
- report.assets.should include(e1)
74
- report.assets.should include(e2)
75
- report.assets.should_not include(e3)
73
+ expect(report.assets).to include(e1)
74
+ expect(report.assets).to include(e2)
75
+ expect(report.assets).not_to include(e3)
76
76
  end
77
77
 
78
78
  it "should find something in one second interval" do
@@ -84,9 +84,9 @@ describe Datagrid::Filters::DateTimeFilter do
84
84
  scope { Entry }
85
85
  filter(:created_at, :datetime, :range => true)
86
86
  end
87
- report.assets.should_not include(e1)
88
- report.assets.should include(e2)
89
- report.assets.should_not include(e3)
87
+ expect(report.assets).not_to include(e1)
88
+ expect(report.assets).to include(e2)
89
+ expect(report.assets).not_to include(e3)
90
90
  end
91
91
  it "should support invalid range" do
92
92
 
@@ -97,9 +97,9 @@ describe Datagrid::Filters::DateTimeFilter do
97
97
  scope { Entry }
98
98
  filter(:created_at, :datetime, :range => true)
99
99
  end
100
- report.assets.should_not include(e1)
101
- report.assets.should_not include(e2)
102
- report.assets.should_not include(e3)
100
+ expect(report.assets).not_to include(e1)
101
+ expect(report.assets).not_to include(e2)
102
+ expect(report.assets).not_to include(e3)
103
103
  end
104
104
 
105
105
 
@@ -110,8 +110,8 @@ describe Datagrid::Filters::DateTimeFilter do
110
110
  where("created_at >= ?", value)
111
111
  end
112
112
  end
113
- report.assets.should_not include(Entry.create!(:created_at => 1.day.ago))
114
- report.assets.should include(Entry.create!(:created_at => DateTime.tomorrow))
113
+ expect(report.assets).not_to include(Entry.create!(:created_at => 1.day.ago))
114
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.tomorrow))
115
115
  end
116
116
 
117
117
 
@@ -127,7 +127,7 @@ describe Datagrid::Filters::DateTimeFilter do
127
127
  scope {Entry}
128
128
  filter(:created_at, :datetime)
129
129
  end
130
- report.created_at.should == DateTime.new(2013,10,01,1,0)
130
+ expect(report.created_at).to eq(DateTime.new(2013,10,01,1,0))
131
131
  end
132
132
 
133
133
  it "should support default explicit datetime" do
@@ -135,7 +135,7 @@ describe Datagrid::Filters::DateTimeFilter do
135
135
  scope {Entry}
136
136
  filter(:created_at, :datetime)
137
137
  end
138
- report.created_at.should == DateTime.new(2013,10,01,1,0)
138
+ expect(report.created_at).to eq(DateTime.new(2013,10,01,1,0))
139
139
  end
140
140
  end
141
141
 
@@ -145,6 +145,6 @@ describe Datagrid::Filters::DateTimeFilter do
145
145
  scope {Entry}
146
146
  filter(:created_at, :datetime, :range => true)
147
147
  end
148
- report.created_at.should == [DateTime.new(2012, 01, 01, 1, 0), DateTime.new(2013, 01, 01, 1, 0)]
148
+ expect(report.created_at).to eq([DateTime.new(2012, 01, 01, 1, 0), DateTime.new(2013, 01, 01, 1, 0)])
149
149
  end
150
150
  end
@@ -11,112 +11,112 @@ describe Datagrid::Filters::DynamicFilter do
11
11
 
12
12
  it "should support = operation" do
13
13
  report.condition = [:name, "=", "hello"]
14
- report.assets.should include(Entry.create!(:name => 'hello'))
15
- report.assets.should_not include(Entry.create!(:name => 'bye'))
14
+ expect(report.assets).to include(Entry.create!(:name => 'hello'))
15
+ expect(report.assets).not_to include(Entry.create!(:name => 'bye'))
16
16
  end
17
17
 
18
18
  it "should support >= operation" do
19
19
  report.condition = [:name, ">=", "d"]
20
- report.assets.should include(Entry.create!(:name => 'x'))
21
- report.assets.should include(Entry.create!(:name => 'd'))
22
- report.assets.should_not include(Entry.create!(:name => 'a'))
20
+ expect(report.assets).to include(Entry.create!(:name => 'x'))
21
+ expect(report.assets).to include(Entry.create!(:name => 'd'))
22
+ expect(report.assets).not_to include(Entry.create!(:name => 'a'))
23
23
  end
24
24
 
25
25
  it "should blank value" do
26
26
  report.condition = [:name, "=", ""]
27
- report.assets.should include(Entry.create!(:name => 'hello'))
27
+ expect(report.assets).to include(Entry.create!(:name => 'hello'))
28
28
  end
29
29
 
30
30
  it "should support =~ operation on strings" do
31
31
  report.condition = [:name, "=~", "ell"]
32
- report.assets.should include(Entry.create!(:name => 'hello'))
33
- report.assets.should_not include(Entry.create!(:name => 'bye'))
32
+ expect(report.assets).to include(Entry.create!(:name => 'hello'))
33
+ expect(report.assets).not_to include(Entry.create!(:name => 'bye'))
34
34
  end
35
35
 
36
36
  it "should support =~ operation integers" do
37
37
  report.condition = [:group_id, "=~", 2]
38
- report.assets.should include(Entry.create!(:group_id => 2))
39
- report.assets.should_not include(Entry.create!(:group_id => 1))
40
- report.assets.should_not include(Entry.create!(:group_id => 3))
38
+ expect(report.assets).to include(Entry.create!(:group_id => 2))
39
+ expect(report.assets).not_to include(Entry.create!(:group_id => 1))
40
+ expect(report.assets).not_to include(Entry.create!(:group_id => 3))
41
41
  end
42
42
 
43
43
  it "should support >= operation on integer" do
44
44
  report.condition = [:group_id, ">=", 2]
45
- report.assets.should include(Entry.create!(:group_id => 3))
46
- report.assets.should_not include(Entry.create!(:group_id => 1))
45
+ expect(report.assets).to include(Entry.create!(:group_id => 3))
46
+ expect(report.assets).not_to include(Entry.create!(:group_id => 1))
47
47
  end
48
48
 
49
49
  it "should support <= operation on integer" do
50
50
  report.condition = [:group_id, "<=", 2]
51
- report.assets.should include(Entry.create!(:group_id => 1))
52
- report.assets.should_not include(Entry.create!(:group_id => 3))
51
+ expect(report.assets).to include(Entry.create!(:group_id => 1))
52
+ expect(report.assets).not_to include(Entry.create!(:group_id => 3))
53
53
  end
54
54
 
55
55
  it "should support <= operation on integer with string value" do
56
56
  report.condition = [:group_id, "<=", '2']
57
- report.assets.should include(Entry.create!(:group_id => 1))
58
- report.assets.should include(Entry.create!(:group_id => 2))
59
- report.assets.should_not include(Entry.create!(:group_id => 3))
57
+ expect(report.assets).to include(Entry.create!(:group_id => 1))
58
+ expect(report.assets).to include(Entry.create!(:group_id => 2))
59
+ expect(report.assets).not_to include(Entry.create!(:group_id => 3))
60
60
  end
61
61
 
62
62
  it "should nullify incorrect value for integer" do
63
63
  report.condition = [:group_id, "<=", 'aa']
64
- report.condition.should == [:group_id, "<=", nil]
64
+ expect(report.condition).to eq([:group_id, "<=", nil])
65
65
  end
66
66
 
67
67
  it "should nullify incorrect value for date" do
68
68
  report.condition = [:shipping_date, "<=", 'aa']
69
- report.condition.should == [:shipping_date, "<=", nil]
69
+ expect(report.condition).to eq([:shipping_date, "<=", nil])
70
70
  end
71
71
 
72
72
  it "should nullify incorrect value for datetime" do
73
73
  report.condition = [:created_at, "<=", 'aa']
74
- report.condition.should == [:created_at, "<=", nil]
74
+ expect(report.condition).to eq([:created_at, "<=", nil])
75
75
  end
76
76
 
77
77
  it "should support date comparation operation by timestamp column" do
78
78
  report.condition = [:created_at, "<=", '1986-08-05']
79
- report.condition.should == [:created_at, "<=", Date.parse('1986-08-05')]
80
- report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-04 01:01:01')))
81
- report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
82
- report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:00')))
83
- report.assets.should_not include(Entry.create!(:created_at => DateTime.parse('1986-08-06 00:00:00')))
84
- report.assets.should_not include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
79
+ expect(report.condition).to eq([:created_at, "<=", Date.parse('1986-08-05')])
80
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-04 01:01:01')))
81
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
82
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:00')))
83
+ expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 00:00:00')))
84
+ expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
85
85
  end
86
86
 
87
87
  it "should support date = operation by timestamp column" do
88
88
  report.condition = [:created_at, "=", '1986-08-05']
89
- report.condition.should == [:created_at, "=", Date.parse('1986-08-05')]
90
- report.assets.should_not include(Entry.create!(:created_at => DateTime.parse('1986-08-04 23:59:59')))
91
- report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
92
- report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:01')))
89
+ expect(report.condition).to eq([:created_at, "=", Date.parse('1986-08-05')])
90
+ expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-04 23:59:59')))
91
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
92
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:01')))
93
93
  #TODO: investigate SQLite issue and uncomment this line
94
94
  #report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:00')))
95
- report.assets.should_not include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
95
+ expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
96
96
  end
97
97
 
98
98
  it "should support date =~ operation by timestamp column" do
99
99
  report.condition = [:created_at, "=~", '1986-08-05']
100
- report.condition.should == [:created_at, "=~", Date.parse('1986-08-05')]
101
- report.assets.should_not include(Entry.create!(:created_at => DateTime.parse('1986-08-04 23:59:59')))
102
- report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
103
- report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:01')))
100
+ expect(report.condition).to eq([:created_at, "=~", Date.parse('1986-08-05')])
101
+ expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-04 23:59:59')))
102
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
103
+ expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:01')))
104
104
  #TODO: investigate SQLite issue and uncomment this line
105
105
  #report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:00')))
106
- report.assets.should_not include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
106
+ expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
107
107
  end
108
108
 
109
109
  it "should support operations for invalid date" do
110
110
  report.condition = [:shipping_date, "<=", '1986-08-05']
111
- report.assets.should include(Entry.create!(:shipping_date => '1986-08-04'))
112
- report.assets.should include(Entry.create!(:shipping_date => '1986-08-05'))
113
- report.assets.should_not include(Entry.create!(:shipping_date => '1986-08-06'))
111
+ expect(report.assets).to include(Entry.create!(:shipping_date => '1986-08-04'))
112
+ expect(report.assets).to include(Entry.create!(:shipping_date => '1986-08-05'))
113
+ expect(report.assets).not_to include(Entry.create!(:shipping_date => '1986-08-06'))
114
114
  end
115
115
  it "should support operations for invalid date" do
116
116
  report.condition = [:shipping_date, "<=", Date.parse('1986-08-05')]
117
- report.assets.should include(Entry.create!(:shipping_date => '1986-08-04'))
118
- report.assets.should include(Entry.create!(:shipping_date => '1986-08-05'))
119
- report.assets.should_not include(Entry.create!(:shipping_date => '1986-08-06'))
117
+ expect(report.assets).to include(Entry.create!(:shipping_date => '1986-08-04'))
118
+ expect(report.assets).to include(Entry.create!(:shipping_date => '1986-08-05'))
119
+ expect(report.assets).not_to include(Entry.create!(:shipping_date => '1986-08-06'))
120
120
  end
121
121
 
122
122
  end
@@ -3,17 +3,17 @@ require 'spec_helper'
3
3
  describe Datagrid::Filters::EnumFilter do
4
4
 
5
5
  it "should support select option" do
6
- test_report do
6
+ expect(test_report do
7
7
  scope {Entry}
8
8
  filter(:group_id, :enum, :select => [1,2] )
9
- end.class.filter_by_name(:group_id).select.should == [1,2]
9
+ end.class.filter_by_name(:group_id).select).to eq([1,2])
10
10
  end
11
11
 
12
12
  it "should support select option as proc" do
13
- test_report do
13
+ expect(test_report do
14
14
  scope {Entry}
15
15
  filter(:group_id, :enum, :select => proc { [1,2] })
16
- end.class.filter_by_name(:group_id).select.should == [1,2]
16
+ end.class.filter_by_name(:group_id).select).to eq([1,2])
17
17
  end
18
18
 
19
19
  it "should support select option as proc with instace input" do
@@ -22,7 +22,7 @@ describe Datagrid::Filters::EnumFilter do
22
22
  filter(:group_id, :enum, :select => proc { |obj| obj.object_id })
23
23
  end.class
24
24
  instance = klass.new
25
- klass.filter_by_name(:group_id).select(instance).should == instance.object_id
25
+ expect(klass.filter_by_name(:group_id).select(instance)).to eq(instance.object_id)
26
26
  end
27
27
 
28
28
  it "should initialize select option only on instanciation" do
@@ -43,7 +43,7 @@ describe Datagrid::Filters::EnumFilter do
43
43
  end
44
44
  end
45
45
 
46
- report.filter_by_name(:group_id).select(report).should == [1,3,5]
46
+ expect(report.filter_by_name(:group_id).select(report)).to eq([1,3,5])
47
47
  end
48
48
 
49
49
  end
@@ -3,10 +3,10 @@ require 'spec_helper'
3
3
  describe Datagrid::Filters::ExtendedBooleanFilter do
4
4
 
5
5
  it "should support select option" do
6
- test_report do
6
+ expect(test_report do
7
7
  scope {Entry}
8
8
  filter(:disabled, :xboolean)
9
- end.class.filter_by_name(:disabled).select.should == [["Yes", "YES"], ["No", "NO"]]
9
+ end.class.filter_by_name(:disabled).select).to eq([["Yes", "YES"], ["No", "NO"]])
10
10
  end
11
11
 
12
12
  it "should generate pass boolean value to filter block" do
@@ -18,17 +18,17 @@ describe Datagrid::Filters::ExtendedBooleanFilter do
18
18
  disabled_entry = Entry.create!(:disabled => true)
19
19
  enabled_entry = Entry.create!(:disabled => false)
20
20
 
21
- grid.disabled.should be_nil
22
- grid.assets.should include(disabled_entry, enabled_entry)
21
+ expect(grid.disabled).to be_nil
22
+ expect(grid.assets).to include(disabled_entry, enabled_entry)
23
23
  grid.disabled = "YES"
24
24
 
25
- grid.disabled.should == "YES"
26
- grid.assets.should include(disabled_entry)
27
- grid.assets.should_not include(enabled_entry)
25
+ expect(grid.disabled).to eq("YES")
26
+ expect(grid.assets).to include(disabled_entry)
27
+ expect(grid.assets).not_to include(enabled_entry)
28
28
  grid.disabled = "NO"
29
- grid.disabled.should == "NO"
30
- grid.assets.should include(enabled_entry)
31
- grid.assets.should_not include(disabled_entry)
29
+ expect(grid.disabled).to eq("NO")
30
+ expect(grid.assets).to include(enabled_entry)
31
+ expect(grid.assets).not_to include(disabled_entry)
32
32
 
33
33
  end
34
34
 
@@ -9,7 +9,7 @@ describe Datagrid::Filters::FloatFilter do
9
9
  scope { Group }
10
10
  filter(:rating, :float)
11
11
  end
12
- report.assets.should include(g1)
13
- report.assets.should_not include(g2)
12
+ expect(report.assets).to include(g1)
13
+ expect(report.assets).not_to include(g2)
14
14
  end
15
15
  end
@@ -10,9 +10,9 @@ describe Datagrid::Filters::IntegerFilter do
10
10
  scope { Entry }
11
11
  filter(:group_id, :integer)
12
12
  end
13
- report.assets.should_not include(e1)
14
- report.assets.should include(e2)
15
- report.assets.should_not include(e3)
13
+ expect(report.assets).not_to include(e1)
14
+ expect(report.assets).to include(e2)
15
+ expect(report.assets).not_to include(e3)
16
16
  end
17
17
 
18
18
  it "should support integer range given as array argument" do
@@ -23,9 +23,9 @@ describe Datagrid::Filters::IntegerFilter do
23
23
  scope { Entry }
24
24
  filter(:group_id, :integer, :range => true)
25
25
  end
26
- report.assets.should_not include(e1)
27
- report.assets.should include(e2)
28
- report.assets.should_not include(e3)
26
+ expect(report.assets).not_to include(e1)
27
+ expect(report.assets).to include(e2)
28
+ expect(report.assets).not_to include(e3)
29
29
  end
30
30
 
31
31
  it "should support minimum integer argument" do
@@ -36,9 +36,9 @@ describe Datagrid::Filters::IntegerFilter do
36
36
  scope { Entry }
37
37
  filter(:group_id, :integer, :range => true)
38
38
  end
39
- report.assets.should_not include(e1)
40
- report.assets.should_not include(e2)
41
- report.assets.should include(e3)
39
+ expect(report.assets).not_to include(e1)
40
+ expect(report.assets).not_to include(e2)
41
+ expect(report.assets).to include(e3)
42
42
  end
43
43
 
44
44
  it "should support maximum integer argument" do
@@ -49,9 +49,9 @@ describe Datagrid::Filters::IntegerFilter do
49
49
  scope { Entry }
50
50
  filter(:group_id, :integer, :range => true)
51
51
  end
52
- report.assets.should include(e1)
53
- report.assets.should include(e2)
54
- report.assets.should_not include(e3)
52
+ expect(report.assets).to include(e1)
53
+ expect(report.assets).to include(e2)
54
+ expect(report.assets).not_to include(e3)
55
55
  end
56
56
 
57
57
  it "should find something in one integer interval" do
@@ -63,9 +63,9 @@ describe Datagrid::Filters::IntegerFilter do
63
63
  scope { Entry }
64
64
  filter(:group_id, :integer, :range => true)
65
65
  end
66
- report.assets.should_not include(e1)
67
- report.assets.should include(e2)
68
- report.assets.should_not include(e3)
66
+ expect(report.assets).not_to include(e1)
67
+ expect(report.assets).to include(e2)
68
+ expect(report.assets).not_to include(e3)
69
69
  end
70
70
  it "should support invalid range" do
71
71
 
@@ -76,9 +76,9 @@ describe Datagrid::Filters::IntegerFilter do
76
76
  scope { Entry }
77
77
  filter(:group_id, :integer, :range => true)
78
78
  end
79
- report.assets.should_not include(e1)
80
- report.assets.should_not include(e2)
81
- report.assets.should_not include(e3)
79
+ expect(report.assets).not_to include(e1)
80
+ expect(report.assets).not_to include(e2)
81
+ expect(report.assets).not_to include(e3)
82
82
  end
83
83
 
84
84
 
@@ -89,8 +89,8 @@ describe Datagrid::Filters::IntegerFilter do
89
89
  where("group_id >= ?", value)
90
90
  end
91
91
  end
92
- report.assets.should_not include(Entry.create!(:group_id => 1))
93
- report.assets.should include(Entry.create!(:group_id => 5))
92
+ expect(report.assets).not_to include(Entry.create!(:group_id => 1))
93
+ expect(report.assets).to include(Entry.create!(:group_id => 5))
94
94
  end
95
95
 
96
96
 
@@ -99,8 +99,8 @@ describe Datagrid::Filters::IntegerFilter do
99
99
  scope { Entry.joins(:group) }
100
100
  filter(:rating, :integer, :range => true)
101
101
  end
102
- report.assets.should_not include(Entry.create!(:group => Group.create!(:rating => 3)))
103
- report.assets.should include(Entry.create!(:group => Group.create!(:rating => 5)))
102
+ expect(report.assets).not_to include(Entry.create!(:group => Group.create!(:rating => 3)))
103
+ expect(report.assets).to include(Entry.create!(:group => Group.create!(:rating => 5)))
104
104
  end
105
105
 
106
106
  it "should support multiple values" do
@@ -108,18 +108,18 @@ describe Datagrid::Filters::IntegerFilter do
108
108
  scope {Entry}
109
109
  filter(:group_id, :string, :multiple => true)
110
110
  end
111
- report.assets.should include(Entry.create!( :group_id => 1))
112
- report.assets.should include(Entry.create!( :group_id => 2))
113
- report.assets.should_not include(Entry.create!( :group_id => 3))
111
+ expect(report.assets).to include(Entry.create!( :group_id => 1))
112
+ expect(report.assets).to include(Entry.create!( :group_id => 2))
113
+ expect(report.assets).not_to include(Entry.create!( :group_id => 3))
114
114
  end
115
115
  it "should support custom separator multiple values" do
116
116
  report = test_report(:group_id => "1|2") do
117
117
  scope {Entry}
118
118
  filter(:group_id, :string, :multiple => '|')
119
119
  end
120
- report.assets.should include(Entry.create!( :group_id => 1))
121
- report.assets.should include(Entry.create!( :group_id => 2))
122
- report.assets.should_not include(Entry.create!( :group_id => 3))
120
+ expect(report.assets).to include(Entry.create!( :group_id => 1))
121
+ expect(report.assets).to include(Entry.create!( :group_id => 2))
122
+ expect(report.assets).not_to include(Entry.create!( :group_id => 3))
123
123
  end
124
124
 
125
125
  it "should support multiple values" do
@@ -127,9 +127,9 @@ describe Datagrid::Filters::IntegerFilter do
127
127
  scope {Entry}
128
128
  filter(:group_id, :string, :multiple => true)
129
129
  end
130
- report.assets.should include(Entry.create!( :group_id => 1))
131
- report.assets.should include(Entry.create!( :group_id => 2))
132
- report.assets.should_not include(Entry.create!( :group_id => 3))
130
+ expect(report.assets).to include(Entry.create!( :group_id => 1))
131
+ expect(report.assets).to include(Entry.create!( :group_id => 2))
132
+ expect(report.assets).not_to include(Entry.create!( :group_id => 3))
133
133
  end
134
134
 
135
135
  it "should support custom separator multiple values" do
@@ -137,8 +137,8 @@ describe Datagrid::Filters::IntegerFilter do
137
137
  scope {Entry}
138
138
  filter(:group_id, :string, :multiple => '|')
139
139
  end
140
- report.assets.should include(Entry.create!( :group_id => 1))
141
- report.assets.should include(Entry.create!( :group_id => 2))
142
- report.assets.should_not include(Entry.create!( :group_id => 3))
140
+ expect(report.assets).to include(Entry.create!( :group_id => 1))
141
+ expect(report.assets).to include(Entry.create!( :group_id => 2))
142
+ expect(report.assets).not_to include(Entry.create!( :group_id => 3))
143
143
  end
144
144
  end