positionable 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -100,7 +100,11 @@ module Positionable
100
100
  private
101
101
 
102
102
  def scoped_condition
103
- "#{scope_id_attr} = " + scope_id.to_s
103
+ if scope_id.nil?
104
+ "#{scope_id_attr} is null"
105
+ else
106
+ "#{scope_id_attr} = " + scope_id.to_s
107
+ end
104
108
  end
105
109
 
106
110
  def scoped_position
@@ -1,3 +1,3 @@
1
1
  module Positionable
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -4,7 +4,7 @@ FactoryGirl.define do
4
4
  sequence(:title) { |n| "Folder #{n}" }
5
5
 
6
6
  factory :folder_with_documents do
7
- after_create do |folder|
7
+ after(:create) do |folder|
8
8
  folder.documents = FactoryGirl.create_list(:document, 5, :folder => folder)
9
9
  end
10
10
  end
@@ -43,7 +43,7 @@ FactoryGirl.define do
43
43
  sequence(:title) { |n| "Group #{n}" }
44
44
 
45
45
  factory :group_with_complex_items do
46
- after_create do |group|
46
+ after(:create) do |group|
47
47
  group.complex_items = FactoryGirl.create_list(:complex_item, 5, :group => group)
48
48
  end
49
49
  end
@@ -432,6 +432,16 @@ describe Positionable do
432
432
  end
433
433
  end
434
434
 
435
+ context "missing scope reference" do
436
+
437
+ it "supports nil scope reference" do
438
+ create(:document, folder: nil).position.should == 0
439
+ create(:document, folder: nil).position.should == 1
440
+ create(:document, folder: nil).position.should == 2
441
+ end
442
+
443
+ end
444
+
435
445
  context "changing scope" do
436
446
 
437
447
  let!(:old_folder) { folders.first }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: positionable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-03 00:00:00.000000000 Z
12
+ date: 2012-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler