filter_fu 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filter_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ hash: 7
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Benedikt Deicke
@@ -9,82 +15,167 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-10-15 00:00:00 +02:00
18
+ date: 2010-12-15 00:00:00 +01:00
13
19
  default_executable:
14
20
  dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ version: 3.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
15
37
  - !ruby/object:Gem::Dependency
16
38
  name: rspec
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 2
48
+ - 0
49
+ version: "2.0"
17
50
  type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: rspec-rails
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 2
63
+ - 0
64
+ version: "2.0"
65
+ type: :development
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: webrat
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
20
72
  requirements:
21
73
  - - ">="
22
74
  - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- description: This Ruby on Rails plugin adds a filtered_by method to your models. It accepts a hash of filters that are applied using named_scopes. In addition the plugin adds some view helpers to easily build filter forms.
26
- email: benedikt@synatic.net
75
+ hash: 7
76
+ segments:
77
+ - 0
78
+ - 7
79
+ - 2
80
+ version: 0.7.2
81
+ type: :development
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: autotest
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 55
92
+ segments:
93
+ - 4
94
+ - 3
95
+ - 2
96
+ version: 4.3.2
97
+ type: :development
98
+ version_requirements: *id005
99
+ - !ruby/object:Gem::Dependency
100
+ name: hanna
101
+ prerelease: false
102
+ requirement: &id006 !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ hash: 3
108
+ segments:
109
+ - 0
110
+ - 1
111
+ - 12
112
+ version: 0.1.12
113
+ type: :development
114
+ version_requirements: *id006
115
+ description: This Ruby on Rails plugin adds a filtered_by method to your models. It accepts a hash of filters that are applied using scopes. In addition the plugin adds some view helpers to easily build filter forms.
116
+ email:
117
+ - benedikt@synatic.net
27
118
  executables: []
28
119
 
29
120
  extensions: []
30
121
 
31
122
  extra_rdoc_files:
32
- - LICENSE
33
123
  - README.rdoc
34
- files:
35
- - .document
36
- - .gitignore
37
124
  - LICENSE
38
- - README.rdoc
39
- - Rakefile
40
- - VERSION
41
- - filter_fu.gemspec
42
- - lib/filter_fu.rb
125
+ files:
43
126
  - lib/filter_fu/active_record.rb
44
127
  - lib/filter_fu/view_helper.rb
45
- - rails/init.rb
128
+ - lib/filter_fu.rb
46
129
  - spec/active_record_spec.rb
47
130
  - spec/db/database.yml
131
+ - spec/db/debug.log
48
132
  - spec/db/schema.rb
49
- - spec/dummies.rb
50
133
  - spec/filter_fu_spec.rb
51
- - spec/fixtures/employee.rb
52
- - spec/spec.opts
134
+ - spec/helpers/view_helper_spec.rb
53
135
  - spec/spec_helper.rb
54
- - spec/view_helper_spec.rb
136
+ - spec/support/dummies.rb
137
+ - spec/support/employee.rb
138
+ - LICENSE
139
+ - README.rdoc
140
+ - Rakefile
141
+ - Gemfile
142
+ - Gemfile.lock
143
+ - .rspec
55
144
  has_rdoc: true
56
- homepage: http://github.com/benedikt/filter_fu
145
+ homepage: http://github.com/benedikt/maptastic
57
146
  licenses: []
58
147
 
59
148
  post_install_message:
60
149
  rdoc_options:
150
+ - --main
151
+ - README.rdoc
61
152
  - --charset=UTF-8
62
153
  require_paths:
63
154
  - lib
64
155
  required_ruby_version: !ruby/object:Gem::Requirement
156
+ none: false
65
157
  requirements:
66
158
  - - ">="
67
159
  - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
68
163
  version: "0"
69
- version:
70
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
+ none: false
71
166
  requirements:
72
167
  - - ">="
73
168
  - !ruby/object:Gem::Version
169
+ hash: 3
170
+ segments:
171
+ - 0
74
172
  version: "0"
75
- version:
76
173
  requirements: []
77
174
 
78
175
  rubyforge_project:
79
- rubygems_version: 1.3.5
176
+ rubygems_version: 1.3.7
80
177
  signing_key:
81
178
  specification_version: 3
82
- summary: Filter ActiveRecord models using named_scopes
83
- test_files:
84
- - spec/active_record_spec.rb
85
- - spec/db/schema.rb
86
- - spec/dummies.rb
87
- - spec/filter_fu_spec.rb
88
- - spec/fixtures/employee.rb
89
- - spec/spec_helper.rb
90
- - spec/view_helper_spec.rb
179
+ summary: Filter ActiveRecord models using scopes
180
+ test_files: []
181
+
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
6
- spec/debug.log
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.0
data/filter_fu.gemspec DELETED
@@ -1,68 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{filter_fu}
8
- s.version = "0.5.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Benedikt Deicke"]
12
- s.date = %q{2009-10-15}
13
- s.description = %q{This Ruby on Rails plugin adds a filtered_by method to your models. It accepts a hash of filters that are applied using named_scopes. In addition the plugin adds some view helpers to easily build filter forms.}
14
- s.email = %q{benedikt@synatic.net}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "filter_fu.gemspec",
27
- "lib/filter_fu.rb",
28
- "lib/filter_fu/active_record.rb",
29
- "lib/filter_fu/view_helper.rb",
30
- "rails/init.rb",
31
- "spec/active_record_spec.rb",
32
- "spec/db/database.yml",
33
- "spec/db/schema.rb",
34
- "spec/dummies.rb",
35
- "spec/filter_fu_spec.rb",
36
- "spec/fixtures/employee.rb",
37
- "spec/spec.opts",
38
- "spec/spec_helper.rb",
39
- "spec/view_helper_spec.rb"
40
- ]
41
- s.homepage = %q{http://github.com/benedikt/filter_fu}
42
- s.rdoc_options = ["--charset=UTF-8"]
43
- s.require_paths = ["lib"]
44
- s.rubygems_version = %q{1.3.5}
45
- s.summary = %q{Filter ActiveRecord models using named_scopes}
46
- s.test_files = [
47
- "spec/active_record_spec.rb",
48
- "spec/db/schema.rb",
49
- "spec/dummies.rb",
50
- "spec/filter_fu_spec.rb",
51
- "spec/fixtures/employee.rb",
52
- "spec/spec_helper.rb",
53
- "spec/view_helper_spec.rb"
54
- ]
55
-
56
- if s.respond_to? :specification_version then
57
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
58
- s.specification_version = 3
59
-
60
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
61
- s.add_development_dependency(%q<rspec>, [">= 0"])
62
- else
63
- s.add_dependency(%q<rspec>, [">= 0"])
64
- end
65
- else
66
- s.add_dependency(%q<rspec>, [">= 0"])
67
- end
68
- end
data/rails/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'filter_fu'
data/spec/dummies.rb DELETED
@@ -1,46 +0,0 @@
1
- # Taken from mislav's will_paginate http://github.com/mislav/will_paginate/tree/master
2
-
3
- class DummyRequest
4
- attr_accessor :symbolized_path_parameters
5
-
6
- def initialize
7
- @get = true
8
- @params = {}
9
- @symbolized_path_parameters = { :controller => 'foo', :action => 'bar' }
10
- end
11
-
12
- def get?
13
- @get
14
- end
15
-
16
- def post
17
- @get = false
18
- end
19
-
20
- def relative_url_root
21
- ''
22
- end
23
-
24
- def params(more = nil)
25
- @params.update(more) if more
26
- @params
27
- end
28
- end
29
-
30
- class DummyController
31
- attr_reader :request
32
- attr_accessor :controller_name
33
-
34
- def initialize
35
- @request = DummyRequest.new
36
- @url = ActionController::UrlRewriter.new(@request, @request.params)
37
- end
38
-
39
- def params
40
- @request.params
41
- end
42
-
43
- def url_for(params)
44
- @url.rewrite(params)
45
- end
46
- end
data/spec/spec.opts DELETED
@@ -1,4 +0,0 @@
1
- --colour
2
- --format progress
3
- --loadby mtime
4
- --reverse
@@ -1,127 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
- require 'dummies'
3
-
4
- describe FilterFu::ViewHelper, :type => :helper do
5
-
6
- before(:each) do
7
- @controller = DummyController.new
8
- @request = @controller.request
9
-
10
- helper.controller = @controller
11
- helper.request = @request
12
-
13
- helper.output_buffer = ""
14
- end
15
-
16
- it "should provide a filter_form_for method" do
17
- helper.should respond_to(:filter_form_for)
18
- end
19
-
20
- it "should prodive a filter_form method as an alias for filter_form" do
21
- helper.should respond_to(:filter_form)
22
- end
23
-
24
- it "should require a block" do
25
- lambda { helper.filter_form_for }.should raise_error(ArgumentError, /Missing block/)
26
- end
27
-
28
- it "should accept options" do
29
- lambda { helper.filter_form_for({}) {} }.should_not raise_error(ArgumentError)
30
- end
31
-
32
- it "should not require options" do
33
- lambda { helper.filter_form_for() {} }.should_not raise_error(ArgumentError)
34
- end
35
-
36
- it "should accept a name together with options" do
37
- lambda { helper.filter_form_for(:other, {}) {} }.should_not raise_error(ArgumentError)
38
- end
39
-
40
- it "should call the associated block" do
41
- lambda {
42
- helper.filter_form_for() { throw :done }
43
- }.should throw_symbol(:done)
44
- end
45
-
46
- it "should pass a ActionView::Helpers::FormBuilder to the block" do
47
- helper.filter_form_for { |f| f.should be_kind_of(ActionView::Helpers::FormBuilder) }
48
- end
49
-
50
- it "should include the erb of the block" do
51
- html = eval_erb("<% filter_form_for { %><div>Some random HTML</div><% } %>")
52
- html.should have_tag('div', 'Some random HTML')
53
- end
54
-
55
- it "should include a form tag" do
56
- html = eval_erb("<% filter_form_for { %> <% } %>")
57
- html.should have_tag('form')
58
- end
59
-
60
- it "should set the form method attribute to GET" do
61
- html = eval_erb("<% filter_form_for { %> <% } %>")
62
- html.should have_tag('form[method=?]', 'get')
63
- end
64
-
65
- it "should set the form action attribute to the current url" do
66
- # Controller and Action are foo and bar as defined in the dummies
67
- html = eval_erb("<% filter_form_for { %> <% } %>")
68
- html.should have_tag('form[action=?]', '/foo/bar')
69
- end
70
-
71
- it "should use :filter as the default namespace in form fields" do
72
- html = eval_erb("<% filter_form_for { |f| %><%= f.text_field :name %><% } %>")
73
- html.should have_tag('input[name=?]', 'filter[name]')
74
- end
75
-
76
- it "should use another name as namespace if it's provided as the first argument" do
77
- html = eval_erb("<% filter_form_for(:other) { |f| %><%= f.text_field :name %><% } %>")
78
- html.should have_tag('input[name=?]', 'other[name]')
79
- end
80
-
81
- it "should pass options to the form_for helper" do
82
- html = eval_erb("<% filter_form_for(:html => { :class => 'filter' }) { |f| %> <% } %>")
83
- html.should have_tag('form[class=?]', 'filter')
84
- end
85
-
86
- it "should preserve the page's parameters with hidden fields" do
87
- helper.params = { :some_param => 'some value', :some_other_param => 'some other value' }
88
- html = eval_erb("<% filter_form_for() { |f| %> <% } %>")
89
- html.should have_tag('input[type=?][name=?][value=?]', 'hidden', 'some_param', 'some value')
90
- html.should have_tag('input[type=?][name=?][value=?]', 'hidden', 'some_other_param', 'some other value')
91
- end
92
-
93
- it "should preserve the page's nested parameters with hidden fields" do
94
- helper.params = { :some_param => 'some value', :nested => { :some_other_param => 'some other value', :deeply_nested => { :down_here => 'yet another value' } } }
95
- html = eval_erb("<% filter_form_for() { |f| %> <% } %>")
96
- html.should have_tag('input[type=?][name=?][value=?]', 'hidden', 'some_param', 'some value')
97
- html.should have_tag('input[type=?][name=?][value=?]', 'hidden', 'nested[some_other_param]', 'some other value')
98
- html.should have_tag('input[type=?][name=?][value=?]', 'hidden', 'nested[deeply_nested][down_here]', 'yet another value')
99
- end
100
-
101
- it "should not preserve the page's parameters for the current filter" do
102
- helper.params = { :other => { :name => 'some value' }}
103
- html = eval_erb("<% filter_form_for(:other) { |f| %> <% } %>")
104
- html.should_not have_tag('input[type=?][name=?]', 'hidden', 'other')
105
- html.should_not have_tag('input[type=?][name=?][value=?]', 'hidden', 'other[name]', 'some value')
106
- end
107
-
108
- it "should not preserve the controller and action params" do
109
- helper.params = { :controller => 'foo', :action => 'bar' }
110
- html = eval_erb("<% filter_form_for() { |f| %> <% } %>")
111
- html.should_not have_tag('input[type=?][name=?][value=?]', 'hidden', 'controller', 'foo')
112
- html.should_not have_tag('input[type=?][name=?][value=?]', 'hidden', 'action', 'bar')
113
- end
114
-
115
- it "should not preserve params specified in :ignore_parameters" do
116
- helper.params = { :some_param => 'some value', :some_other_param => 'some other value' }
117
- html = eval_erb("<% filter_form_for(:ignore_parameters => [:some_other_param]) { |f| %> <% } %>")
118
- html.should have_tag('input[type=?][name=?][value=?]', 'hidden', 'some_param', 'some value')
119
- html.should_not have_tag('input[type=?][name=?][value=?]', 'hidden', 'some_other_param', 'some other value')
120
- end
121
-
122
- it "should use the current filter params as defaults for the form" do
123
- helper.params = { :filter => { :some_param => 'some value' } }
124
- html = eval_erb("<% filter_form_for() { |f| %><%= f.text_field :some_param %><% } %>")
125
- html.should have_tag('input[type=?][name=?][value=?]', 'text', 'filter[some_param]', 'some value')
126
- end
127
- end