specstar-controllers 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/specstar/controllers.rb +32 -0
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7a385633a32305657451773a60dd9db36ca7bd9
4
- data.tar.gz: f9f514f12b7ee4bb1f90553ee4ea4cdae3b929a4
3
+ metadata.gz: 50aaaa66fb3903aeca6945c78fee68a2c3d948be
4
+ data.tar.gz: b8848dca93f4d1c0eb640d88d344e894475ef6a0
5
5
  SHA512:
6
- metadata.gz: fb321f8f6dc9e08bfbcbfe0dd367a517eabbd4fe8ca95593fa61dfca30c45bf5d17830fa106b71d7a13e21b01573685d6467f3baa2ba1be337b4f0fa9f3431a1
7
- data.tar.gz: ea8687d07dc2782fe49df70d67d51aa3b82149155c8c905f11f9cab3c77e2b998d6f93e40d10334e351567d58364a01b416c27edd2b92fb0f126344a7ed5be2e
6
+ metadata.gz: 0a01ee523a2b89a7f7cbf05d47b865479378e30ac7f50a0d5f98ba9c4066b12f985bc448482ebd7913a219669064927bca74e9f731d06a118005c6f2d8e5675d
7
+ data.tar.gz: 29c6359ac9f8ae89f1a516a8beb9ef9e84ca464d40a756d82fe08a6be4a12c17eff54550d7e9455397edde868c1bc0efbad1787494bfec654f89d54e78e48da5
@@ -79,6 +79,10 @@ module Specstar
79
79
  result
80
80
  end
81
81
 
82
+ def has_before_action?(controller, action, options={})
83
+ has_before_filter? controller, action, options
84
+ end
85
+
82
86
  RSpec::Matchers.define :have_skip_before_filter do |filter|
83
87
  chain :only do |actions|
84
88
  @actions = *actions
@@ -101,6 +105,34 @@ module Specstar
101
105
  end
102
106
  end
103
107
 
108
+
109
+ RSpec::Matchers.define :have_before_action do |action, options={}|
110
+ match do |controller|
111
+ has_before_action?(controller, action, options)
112
+ end
113
+
114
+ failure_message do |controller|
115
+ if options
116
+ "Expected #{controller.class.name} to have a before_action #{action} with #{options}."
117
+ else
118
+ "Expected #{controller.class.name} to have a before_action #{action}."
119
+ end
120
+ end
121
+
122
+ failure_message_when_negated do |controller|
123
+ if options
124
+ "Expected #{controller.class.name} not to have a before_action #{action} with #{options}."
125
+ else
126
+ "Expected #{controller.class.name} not to have a before_action #{action}."
127
+ end
128
+ end
129
+
130
+ description do
131
+ "have a before action '#{action}'."
132
+ end
133
+ end
134
+
135
+
104
136
  RSpec::Matchers.define :have_before_filter do |filter, options={}|
105
137
  match do |controller|
106
138
  has_before_filter?(controller, filter, options)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specstar-controllers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sujoy Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2016-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  version: '0'
51
51
  requirements: []
52
52
  rubyforge_project:
53
- rubygems_version: 2.4.6
53
+ rubygems_version: 2.4.8
54
54
  signing_key:
55
55
  specification_version: 4
56
56
  summary: RSpec helpers for controllers.