scope_chain 0.0.6 → 0.0.7

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,3 +1,3 @@
1
1
  module ScopeChain
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/scope_chain.rb CHANGED
@@ -1,6 +1,12 @@
1
1
  require "scope_chain/version"
2
2
 
3
3
  module ScopeChain
4
+ module RspecHelpers
5
+ def scope_chain(&block)
6
+ ScopeChain.for(described_class, &block)
7
+ end
8
+ end
9
+
4
10
  def self.for(klass, &block)
5
11
  Chain.new klass, &block
6
12
  end
@@ -112,7 +118,7 @@ module ScopeChain
112
118
  end
113
119
 
114
120
  def link_named_scopes
115
- return unless klass.respond_to?(:scopes)
121
+ return unless klass.respond_to?(:scopes) && klass.scopes.present?
116
122
 
117
123
  klass.scopes[klass.name].each do |named|
118
124
  self.define_singleton_method(named) do |*arguments|
@@ -135,5 +141,4 @@ class ActiveRecord::Base
135
141
  class << self
136
142
  alias_method_chain :scope, :tracking
137
143
  end
138
-
139
144
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: scope_chain
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jon Moses