specstar-controllers 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/specstar/controllers.rb +10 -6
  2. metadata +2 -2
@@ -18,15 +18,19 @@ module Specstar
18
18
  end
19
19
 
20
20
  def has_skip_before_filter?(controller, filter, actions)
21
- controller._process_action_callbacks.select { |callback|
22
- callback.chain.select { |chain|
23
- actions_match = actions.nil? || actions.select { |action| !chain.per_key[:unless].include?("action_name == '#{action}'") }.empty?
24
- chain.kind == :before && chain.filter.to_s == filter.to_s && actions_match
21
+ if actions.present?
22
+ controller._process_action_callbacks.select { |callback|
23
+ callback.chain.select { |chain|
24
+ actions_match = actions.select { |action| !chain.per_key[:unless].include?("action_name == '#{action}'") }.empty?
25
+ chain.kind == :before && chain.filter.to_s == filter.to_s && actions_match
26
+ }.size > 0
25
27
  }.size > 0
26
- }.size > 0
28
+ else
29
+ !has_before_filter?(controller, filter)
30
+ end
27
31
  end
28
32
 
29
- def has_before_filter?(controller, filter, action)
33
+ def has_before_filter?(controller, filter, action=nil)
30
34
  callbacks = controller.is_a?(ApplicationController) ? controller._process_action_callbacks : controller._dispatch_callbacks
31
35
  callbacks.select { |callback|
32
36
  callback.chain.select { |chain|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specstar-controllers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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-10-26 00:00:00.000000000 Z
12
+ date: 2012-10-30 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: sujoyg@gmail.com