specstar-controllers 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/lib/specstar/controllers.rb +32 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50aaaa66fb3903aeca6945c78fee68a2c3d948be
|
4
|
+
data.tar.gz: b8848dca93f4d1c0eb640d88d344e894475ef6a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a01ee523a2b89a7f7cbf05d47b865479378e30ac7f50a0d5f98ba9c4066b12f985bc448482ebd7913a219669064927bca74e9f731d06a118005c6f2d8e5675d
|
7
|
+
data.tar.gz: 29c6359ac9f8ae89f1a516a8beb9ef9e84ca464d40a756d82fe08a6be4a12c17eff54550d7e9455397edde868c1bc0efbad1787494bfec654f89d54e78e48da5
|
data/lib/specstar/controllers.rb
CHANGED
@@ -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.
|
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:
|
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.
|
53
|
+
rubygems_version: 2.4.8
|
54
54
|
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: RSpec helpers for controllers.
|