specstar-controllers 0.0.1 → 0.0.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.
Files changed (2) hide show
  1. data/lib/specstar/controllers.rb +26 -2
  2. metadata +2 -2
@@ -12,7 +12,7 @@ module Specstar
12
12
  def has_skip_before_filter?(controller, filter, action)
13
13
  controller._process_action_callbacks.select { |callback|
14
14
  callback.chain.select { |chain|
15
- chain.kind == :before && chain.filter == filter && (action.nil? || chain.per_key[:unless].include?("action_name == '#{action}'"))
15
+ chain.kind == :before && chain.filter.to_s == filter.to_s && (action.nil? || chain.per_key[:unless].include?("action_name == '#{action}'"))
16
16
  }.size > 0
17
17
  }.size > 0
18
18
  end
@@ -21,7 +21,7 @@ module Specstar
21
21
  callbacks = controller.is_a?(ApplicationController) ? controller._process_action_callbacks : controller._dispatch_callbacks
22
22
  callbacks.select { |callback|
23
23
  callback.chain.select { |chain|
24
- chain.kind == :before && chain.filter == filter && (action.nil? || chain.per_key[:if].include?("action_name == '#{action}'"))
24
+ chain.kind == :before && chain.filter.to_s == filter.to_s && (action.nil? || chain.per_key[:if].include?("action_name == '#{action}'"))
25
25
  }.size > 0
26
26
  }.size > 0
27
27
  end
@@ -34,6 +34,18 @@ module Specstar
34
34
  match do |controller|
35
35
  has_skip_before_filter?(controller, filter, @action)
36
36
  end
37
+
38
+ failure_message_for_should do |controller|
39
+ "Expected #{controller.class.name} to have a skip before filter '#{filter}'."
40
+ end
41
+
42
+ failure_message_for_should_not do |controller|
43
+ "Expected #{controller.class.name} not to have a skip before filter '#{filter}'."
44
+ end
45
+
46
+ description do
47
+ "have a skip before filter '#{filter}'."
48
+ end
37
49
  end
38
50
 
39
51
  RSpec::Matchers.define :have_before_filter do |filter|
@@ -44,6 +56,18 @@ module Specstar
44
56
  match do |controller|
45
57
  has_before_filter?(controller, filter, @action)
46
58
  end
59
+
60
+ failure_message_for_should do |controller|
61
+ "Expected #{controller.class.name} to have a before filter '#{filter}'."
62
+ end
63
+
64
+ failure_message_for_should_not do |controller|
65
+ "Expected #{controller.class.name} not to have a before filter '#{filter}'."
66
+ end
67
+
68
+ description do
69
+ "have a before filter '#{filter}'."
70
+ end
47
71
  end
48
72
  end
49
73
  end
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.1
4
+ version: 0.0.2
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-10 00:00:00.000000000 Z
12
+ date: 2012-10-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: sujoyg@gmail.com