refinuri 0.5.1 → 0.5.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/TODO ADDED
@@ -0,0 +1,4 @@
1
+ [ ] get ranges and unbounded ranges working with inclusive/exclusive sets
2
+ [ ] make it so the helpers don't assume filters are stored in @filter
3
+ [ ] get tests for helpers and ActiveRecord mixins working
4
+ [?] why do tests break with the includes in refiuri.rb?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -14,5 +14,5 @@ module Refinuri
14
14
  include Refinuri::Query
15
15
  end
16
16
 
17
- ActionView::Base.send :include, Refinuri::Helpers
18
- ActiveRecord::Base.send :extend, Refinuri::Query
17
+ ActionView::Base.send(:include, Refinuri::Helpers) if Object.const_defined?("ActionView")
18
+ ActiveRecord::Base.send(:extend, Refinuri::Query) if Object.const_defined?("ActiveRecord")
@@ -1,15 +1,17 @@
1
1
  module Refinuri
2
2
  module Query
3
3
  def filtered(filterset)
4
- filtered_self = self
5
-
6
- if filterset
4
+ if filterset.is_a?(Refinuri::Base::FilterSet)
5
+ filtered_self = self.scoped
6
+
7
7
  filterset.filters.each do |name,filter_obj|
8
8
  filtered_self = filtered_self.where(filter_obj.to_db)
9
- end
9
+ end
10
+
11
+ return filtered_self.scoped
12
+ else
13
+ return self
10
14
  end
11
-
12
- return filtered_self.scoped
13
15
  end
14
16
  end
15
17
  end
Binary file
@@ -5,22 +5,24 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{refinuri}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chris Kalafarski"]
12
- s.date = %q{2010-02-07}
12
+ s.date = %q{2010-02-08}
13
13
  s.description = %q{Helps clean up complex URLs with filtering query string, like you may find in an online store}
14
14
  s.email = %q{chris@farski.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.md"
17
+ "README.md",
18
+ "TODO"
18
19
  ]
19
20
  s.files = [
20
21
  ".gitignore",
21
22
  "LICENSE",
22
23
  "README.md",
23
24
  "Rakefile",
25
+ "TODO",
24
26
  "VERSION",
25
27
  "lib/refinuri.rb",
26
28
  "lib/refinuri/base.rb",
@@ -29,11 +31,13 @@ Gem::Specification.new do |s|
29
31
  "lib/refinuri/parser.rb",
30
32
  "lib/refinuri/query.rb",
31
33
  "lib/refinuri/utilities.rb",
34
+ "refinuri-0.5.1.gem",
32
35
  "refinuri.gemspec",
33
36
  "test/helper.rb",
34
37
  "test/test_array_filters.rb",
35
38
  "test/test_helpers.rb",
36
39
  "test/test_parser.rb",
40
+ "test/test_rails_integration.rb",
37
41
  "test/test_range_filters.rb",
38
42
  "test/test_refinuri.rb",
39
43
  "test/test_unbounded_range_filters.rb",
@@ -49,6 +53,7 @@ Gem::Specification.new do |s|
49
53
  "test/test_array_filters.rb",
50
54
  "test/test_helpers.rb",
51
55
  "test/test_parser.rb",
56
+ "test/test_rails_integration.rb",
52
57
  "test/test_range_filters.rb",
53
58
  "test/test_refinuri.rb",
54
59
  "test/test_unbounded_range_filters.rb",
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'shoulda'
4
+ require 'activerecord'
4
5
 
5
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -0,0 +1,33 @@
1
+ require 'helper'
2
+
3
+ class TestRailsIntegration < Test::Unit::TestCase
4
+ context "ActiveRecord objects" do
5
+ setup do
6
+ class Item < ActiveRecord::Base
7
+ end
8
+
9
+ @item = Item
10
+ @set = Refinuri::Base::FilterSet.new({ :name => 'apple' })
11
+ end
12
+
13
+ should "should respond to #filtered" do
14
+ assert Item.respond_to?("filtered")
15
+ end
16
+
17
+ should "act unaltered if #filtered isn't given a FilterSet" do
18
+ assert_equal @item, Item.filtered(nil)
19
+ end
20
+
21
+ should "act filtered if #filtered is given a FilterSet" do
22
+ # assert_equal @item, Item.filtered(@set)
23
+ end
24
+ end
25
+
26
+ context "ActionView" do
27
+ should "make filter_with_link available" do
28
+ end
29
+
30
+ should "make toggle_filter_with_link available" do
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinuri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Kalafarski
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-07 00:00:00 -05:00
12
+ date: 2010-02-08 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -31,11 +31,13 @@ extensions: []
31
31
  extra_rdoc_files:
32
32
  - LICENSE
33
33
  - README.md
34
+ - TODO
34
35
  files:
35
36
  - .gitignore
36
37
  - LICENSE
37
38
  - README.md
38
39
  - Rakefile
40
+ - TODO
39
41
  - VERSION
40
42
  - lib/refinuri.rb
41
43
  - lib/refinuri/base.rb
@@ -44,11 +46,13 @@ files:
44
46
  - lib/refinuri/parser.rb
45
47
  - lib/refinuri/query.rb
46
48
  - lib/refinuri/utilities.rb
49
+ - refinuri-0.5.1.gem
47
50
  - refinuri.gemspec
48
51
  - test/helper.rb
49
52
  - test/test_array_filters.rb
50
53
  - test/test_helpers.rb
51
54
  - test/test_parser.rb
55
+ - test/test_rails_integration.rb
52
56
  - test/test_range_filters.rb
53
57
  - test/test_refinuri.rb
54
58
  - test/test_unbounded_range_filters.rb
@@ -86,6 +90,7 @@ test_files:
86
90
  - test/test_array_filters.rb
87
91
  - test/test_helpers.rb
88
92
  - test/test_parser.rb
93
+ - test/test_rails_integration.rb
89
94
  - test/test_range_filters.rb
90
95
  - test/test_refinuri.rb
91
96
  - test/test_unbounded_range_filters.rb