acts_as_ordinalized 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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_ordinalized}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mandaryn"]
@@ -34,7 +34,7 @@ module ActsAsOrdinalized
34
34
  collection_or_object.each_with_index do |item, index|
35
35
  item.ordinal_number = ordinal_base + index
36
36
  end
37
- else
37
+ elsif !collection_or_object.nil?
38
38
  collection_or_object.ordinal_number = ordinal_base
39
39
  end
40
40
  collection_or_object
@@ -46,6 +46,13 @@ class OrdinalTest < Test::Unit::TestCase
46
46
  even = Ordinal.all(:conditions => { :switch => true }, :order => "test_order ASC")
47
47
  assert_equal [[2,1], [4,2]], even.map{|o| [o.test_order, o.ordinal_number] }
48
48
  end
49
+
50
+ def test_nil_and_empty_results
51
+ empty = Ordinal.all(:conditions => ['test_order > 15'])
52
+ assert_equal [], empty
53
+ empty = Ordinal.last(:conditions => ['test_order > 15'])
54
+ assert_equal nil, empty
55
+ end
49
56
  end
50
57
  begin
51
58
  require 'will_paginate'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_ordinalized
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
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
  - mandaryn