livelist-rails 0.0.10 → 0.0.11

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.
@@ -1,7 +1,7 @@
1
1
  module Livelist
2
2
  module Rails
3
- VERSION = '0.0.10'
4
- LIVELIST_VERSION = '0.0.5'
3
+ VERSION = '0.0.11'
4
+ LIVELIST_VERSION = '73a5124e4aee536963e90935f02566d67030d2ea'
5
5
  MUSTACHE_VERSION = 'db5f5ece0b6c87bbb2d0584010b97f8723dde69d'
6
6
  UNDERSCORE_VERSION = '1.2.3'
7
7
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = ["patrick.klingemann@gmail.com"]
10
10
  s.homepage = ""
11
11
  s.summary = %q{A Rails Engine/Extension Incorporating Livelist.js}
12
- s.description = %q{livelist-rails is a Rails 3.1 Engine/Extensiont incorporating the following javascript libraries: Mustache.js, underscore.js, jQuery and livelist.js, and providing ActiveRecord filtering extenstions.}
12
+ s.description = %q{livelist-rails is a Rails 3.1 Engine/Extension incorporating the following javascript libraries: Mustache.js, underscore.js, jQuery and livelist.js, and providing ActiveRecord filtering extenstions.}
13
13
 
14
14
  s.rubyforge_project = "livelist-rails"
15
15
 
@@ -18,8 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- # specify any dependencies here; for example:
22
- s.add_development_dependency "rspec"
23
- s.add_development_dependency "activerecord"
24
- #s.add_runtime_dependency "rest-client"
21
+ s.add_development_dependency 'rspec'
22
+ s.add_development_dependency 'activerecord'
25
23
  end
@@ -9,203 +9,15 @@ describe Livelist::Rails::ActiveRecord do
9
9
 
10
10
  subject { User }
11
11
 
12
- context :filter_name do
13
- it { subject.should respond_to(:state_filter_name) }
14
- it { subject.should respond_to(:status_filter_name) }
12
+ context :filter_for do
15
13
 
16
- it { subject.state_filter_name.should == 'State' }
17
- end
18
-
19
- context :filter_slug do
20
- it { subject.should respond_to(:state_filter_slug) }
21
- it { subject.should respond_to(:status_filter_slug) }
22
-
23
- it { subject.state_filter_slug.should == 'state' }
24
- end
25
-
26
- context :filter do
27
- let(:options) do
28
- [{
29
- :slug => 'virginia',
30
- :name => 'Virginia',
31
- :value => 'virginia',
32
- :count => 1,
33
- :selected => true
34
- }]
35
- end
36
-
37
- it { subject.should respond_to(:state_filter) }
38
- it { subject.should respond_to(:status_filter) }
39
-
40
- it 'should be a hash with the proper keys/values' do
41
- subject.should_receive(:state_filter_slug).and_return('state')
42
- subject.should_receive(:state_filter_name).and_return('State')
43
- subject.state_filter(options).should == {
44
- :filter_slug => 'state',
45
- :name => 'State',
46
- :options => options
47
- }
48
- end
49
- end
50
-
51
- context :filter_values do
52
- let(:values) do
53
- [
54
- double('Object', :state => 'Virginia'),
55
- double('Object', :state => 'South Carolina')
56
- ]
57
- end
58
-
59
- it { subject.should respond_to(:state_filter_values) }
60
- it { subject.should respond_to(:status_filter_values) }
61
-
62
- it 'should return a mapped list of values' do
63
- subject.should_receive(:select).and_return(values)
64
- subject.state_filter_values.should == ['Virginia', 'South Carolina']
65
- end
66
- end
67
-
68
- context :filter_counts do
69
- it { subject.should respond_to(:state_filter_counts) }
70
- it { subject.should respond_to(:status_filter_counts) }
71
-
72
- it 'should be tested' do
73
- pending
74
- end
75
- end
76
-
77
- context :filter_option_slug do
78
- let(:option) { 'virginia' }
79
-
80
- it { subject.should respond_to(:state_filter_option_slug) }
81
- it { subject.should respond_to(:status_filter_option_slug) }
82
-
83
- it { subject.state_filter_option_slug(option).should == 'virginia' }
84
- end
85
-
86
- context :filter_option_name do
87
- let(:option) { 'virginia' }
88
-
89
- it { subject.should respond_to(:state_filter_option_name) }
90
- it { subject.should respond_to(:status_filter_option_name) }
91
-
92
- it { subject.state_filter_option_name(option).should == 'Virginia' }
93
- end
94
-
95
- context :filter_option_value do
96
- let(:option) { 'virginia' }
97
-
98
- it { subject.should respond_to(:state_filter_option_count) }
99
- it { subject.should respond_to(:status_filter_option_count) }
100
-
101
- it { subject.state_filter_option_value(option).should == 'virginia' }
102
- end
103
-
104
- context :filter_option_count do
105
- let(:option) { 'Virginia' }
106
- let(:state_filter_counts) { { 'Virginia' => 1, 'South Carolina' => 2 } }
107
-
108
- it { subject.should respond_to(:state_filter_option_count) }
109
- it { subject.should respond_to(:status_filter_option_count) }
110
-
111
- it 'option argument should be converted to a string' do
112
- state_filter_counts['1'] = 3
113
- subject.should_receive(:state_filter_counts).and_return(state_filter_counts)
114
- subject.state_filter_option_count(1).should == 3
115
- end
116
-
117
- it 'should be the proper count for the option' do
118
- subject.should_receive(:state_filter_counts).and_return(state_filter_counts)
119
- subject.state_filter_option_count(option).should == 1
120
- end
121
-
122
- it 'should be 0 if the value for the option is nil' do
123
- subject.should_receive(:state_filter_counts).and_return(state_filter_counts)
124
- subject.state_filter_option_count('West Virginia').should == 0
125
- end
126
-
127
- it 'should cache the counts when the method is first called' do
128
- pending
129
- #subject.should_receive(:state_filter_counts).exactly(1).times.and_return(state_filter_counts)
130
- #subject.state_filter_option_count(option)
131
- #subject.state_filter_option_count('South Carolina')
132
- end
133
- end
134
-
135
- context :filter_option do
136
- let(:option) { 'virginia' }
137
- let(:selected) { true }
138
-
139
- it { subject.should respond_to(:state_filter_option) }
140
- it { subject.should respond_to(:status_filter_option) }
141
-
142
- it 'should be a properly formatted hash' do
143
- subject.should_receive(:state_filter_option_slug).and_return('virginia')
144
- subject.should_receive(:state_filter_option_name).and_return('Virginia')
145
- subject.should_receive(:state_filter_option_value).and_return('virginia')
146
- subject.should_receive(:state_filter_option_count).and_return(1)
147
- subject.state_filter_option(option, selected).should == {
148
- :slug => 'virginia',
149
- :name => 'Virginia',
150
- :value => 'virginia',
151
- :count => 1,
152
- :selected => true
153
- }
154
- end
155
- end
156
-
157
- context :filter_option_selected? do
158
- let(:option) { 'Virginia' }
159
- let(:filter_params) { ['Virginia', 'South Carolina'] }
160
-
161
- it { subject.should respond_to(:state_filter_option_selected?) }
162
- it { subject.should respond_to(:status_filter_option_selected?) }
163
-
164
- it 'should be true if the option is included in the filter params' do
165
- subject.state_filter_option_selected?(filter_params, option).should be_true
166
- end
167
-
168
- it 'should be true if filter params is nil' do
169
- subject.state_filter_option_selected?(nil, option).should be_true
170
- end
171
-
172
- it 'should be false if the option is not included in the filter params' do
173
- subject.state_filter_option_selected?(['West Virginia'], option).should be_false
174
- end
175
- end
176
-
177
- context :filters do
178
- it { subject.should respond_to(:state_filters) }
179
- it { subject.should respond_to(:status_filters) }
180
-
181
- it 'should be tested' do
182
- pending
183
- end
184
- end
185
-
186
- context :relation do
187
- it { subject.should respond_to(:state_relation) }
188
- it { subject.should respond_to(:status_relation) }
189
-
190
- it 'should be tested' do
191
- pending
192
- end
193
14
  end
194
15
 
195
16
  context :filters_as_json do
196
- it { subject.should respond_to(:filters_as_json) }
197
17
 
198
- it 'should be tested' do
199
- pending
200
- end
201
18
  end
202
19
 
203
20
  context :filter do
204
- it { subject.should respond_to(:filter) }
205
21
 
206
- it 'should be tested' do
207
- pending
208
- end
209
22
  end
210
-
211
23
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper.rb'
2
+ require File.expand_path('./lib/livelist/rails/filter_collection.rb')
3
+
4
+ describe Livelist::Rails::FilterCollection do
5
+ subject { FilterCollection.new }
6
+
7
+ context :filters do
8
+
9
+ end
10
+
11
+ context :find_filter do
12
+
13
+ end
14
+
15
+ context :create_filter do
16
+
17
+ end
18
+
19
+ context :relation do
20
+
21
+ end
22
+
23
+ context :as_json do
24
+
25
+ end
26
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper.rb'
2
+ require File.expand_path('./lib/livelist/rails/filter_criteria.rb')
3
+
4
+ describe Livelist::Rails::FilterCriteria do
5
+ subject { FilterCriteria.new }
6
+
7
+ context :criteria do
8
+
9
+ end
10
+
11
+ context :find_criteria do
12
+
13
+ end
14
+
15
+ context :slug do
16
+
17
+ end
18
+
19
+ context :initialize do
20
+
21
+ end
22
+
23
+ context :default_reference_criteria do
24
+
25
+ end
26
+
27
+ context :create_criterion do
28
+
29
+ end
30
+
31
+ context :slugs do
32
+
33
+ end
34
+
35
+ context :counts= do
36
+
37
+ end
38
+
39
+ context :as_json do
40
+
41
+ end
42
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper.rb'
2
+ require File.expand_path('./lib/livelist/rails/filter_criterion.rb')
3
+
4
+ describe Livelist::Rails::FilterCritereon do
5
+ subject { FilterCritereon.new }
6
+
7
+ context :initialize do
8
+
9
+ end
10
+
11
+ context :selected? do
12
+
13
+ end
14
+
15
+ context :as_json do
16
+
17
+ end
18
+
19
+ context :infer_type do
20
+
21
+ end
22
+
23
+ context :infer_name_key do
24
+
25
+ end
26
+
27
+ context :infer_slug do
28
+
29
+ end
30
+
31
+ context :infer_name do
32
+
33
+ end
34
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper.rb'
2
+ require File.expand_path('./lib/livelist/rails/filter.rb')
3
+
4
+ describe Livelist::Rails::Filter do
5
+ subject { Filter.new }
6
+
7
+ context :initialize do
8
+
9
+ end
10
+
11
+ context :group_by do
12
+
13
+ end
14
+
15
+ context :exclude_filter_relation? do
16
+
17
+ end
18
+
19
+ context :set_criteria_counts do
20
+
21
+ end
22
+
23
+ context :relation do
24
+
25
+ end
26
+
27
+ context :counts do
28
+
29
+ end
30
+
31
+ context :table_name do
32
+
33
+ end
34
+
35
+ context :model_class do
36
+
37
+ end
38
+
39
+ context :where do
40
+
41
+ end
42
+
43
+ context :as_json do
44
+
45
+ end
46
+
47
+ context :default_key_name do
48
+
49
+ end
50
+
51
+ context :initialize_type do
52
+
53
+ end
54
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livelist-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-16 00:00:00.000000000Z
12
+ date: 2012-03-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &19316400 !ruby/object:Gem::Requirement
16
+ requirement: &8002740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *19316400
24
+ version_requirements: *8002740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &19315980 !ruby/object:Gem::Requirement
27
+ requirement: &8002320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *19315980
36
- description: ! 'livelist-rails is a Rails 3.1 Engine/Extensiont incorporating the
37
- following javascript libraries: Mustache.js, underscore.js, jQuery and livelist.js,
38
- and providing ActiveRecord filtering extenstions.'
35
+ version_requirements: *8002320
36
+ description: ! 'livelist-rails is a Rails 3.1 Engine/Extension incorporating the following
37
+ javascript libraries: Mustache.js, underscore.js, jQuery and livelist.js, and providing
38
+ ActiveRecord filtering extenstions.'
39
39
  email:
40
40
  - patrick.klingemann@gmail.com
41
41
  executables: []
@@ -58,10 +58,18 @@ files:
58
58
  - lib/livelist/rails.rb
59
59
  - lib/livelist/rails/active_record.rb
60
60
  - lib/livelist/rails/engine.rb
61
+ - lib/livelist/rails/filter.rb
62
+ - lib/livelist/rails/filter_collection.rb
63
+ - lib/livelist/rails/filter_criteria.rb
64
+ - lib/livelist/rails/filter_criterion.rb
61
65
  - lib/livelist/rails/railtie.rb
62
66
  - lib/livelist/rails/version.rb
63
67
  - livelist-rails.gemspec
64
68
  - spec/livelist/rails/active_record_spec.rb
69
+ - spec/livelist/rails/filter_collection_spec.rb
70
+ - spec/livelist/rails/filter_criteria_spec.rb
71
+ - spec/livelist/rails/filter_criterion_spec.rb
72
+ - spec/livelist/rails/filter_spec.rb
65
73
  - spec/livelist/spec_helper.rb
66
74
  - spec/spec_helper.rb
67
75
  homepage: ''
@@ -84,11 +92,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
92
  version: '0'
85
93
  requirements: []
86
94
  rubyforge_project: livelist-rails
87
- rubygems_version: 1.8.15
95
+ rubygems_version: 1.8.10
88
96
  signing_key:
89
97
  specification_version: 3
90
98
  summary: A Rails Engine/Extension Incorporating Livelist.js
91
99
  test_files:
92
100
  - spec/livelist/rails/active_record_spec.rb
101
+ - spec/livelist/rails/filter_collection_spec.rb
102
+ - spec/livelist/rails/filter_criteria_spec.rb
103
+ - spec/livelist/rails/filter_criterion_spec.rb
104
+ - spec/livelist/rails/filter_spec.rb
93
105
  - spec/livelist/spec_helper.rb
94
106
  - spec/spec_helper.rb