shadow_controller 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -10
- data/lib/shadow_controller.rb +2 -1
- data/lib/shadow_controller/version.rb +1 -1
- data/shadow_controller.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e019ba6efdfdcfe0ff0c1986865b82fb3524573
|
4
|
+
data.tar.gz: 5d5db4fa41683f0c908e24a1509acb4cd13f796a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92f2366ea2f1ed7a75d519cc27498a6a3db89b2fc9b899aadce954e6d44e7a248017dcb00209ebb233d630d3455e445aeaf2cb06687220e13fb82bba8bbb36d3
|
7
|
+
data.tar.gz: f0ff9799894917995a0685ad01c7c6b31e9d23fc772d46471a832fa052d390708a8ccb877b6c91284fc76d4613bd9450f41643292eeba68328bfa66ac671369b
|
data/README.md
CHANGED
@@ -25,7 +25,9 @@ Or install it yourself as:
|
|
25
25
|
|
26
26
|
## Usage
|
27
27
|
|
28
|
-
|
28
|
+
Install [rspec-rails](https://github.com/rspec/rspec-rails)
|
29
|
+
|
30
|
+
Include ShadowController in your RSpec configure.
|
29
31
|
|
30
32
|
```ruby
|
31
33
|
# spec/spec_helper.rb
|
@@ -34,13 +36,13 @@ RSpec.configure do |config|
|
|
34
36
|
end
|
35
37
|
```
|
36
38
|
|
37
|
-
|
39
|
+
Use the cast_shadow method in your spec
|
38
40
|
```ruby
|
39
41
|
# spec/controllers/application_controller_spec.rb
|
40
42
|
require "spec_helper"
|
41
43
|
|
42
44
|
describe ApplicationController, type: :controller do
|
43
|
-
|
45
|
+
shadow_controller
|
44
46
|
|
45
47
|
it "..." do
|
46
48
|
...
|
@@ -49,10 +51,12 @@ end
|
|
49
51
|
|
50
52
|
```
|
51
53
|
|
52
|
-
## Example
|
54
|
+
## Example Use-case
|
53
55
|
|
54
|
-
Your ApplicationController
|
55
56
|
```ruby
|
57
|
+
# config/routes.rb
|
58
|
+
get "/resource", to: "application#redirect_somewhere"
|
59
|
+
|
56
60
|
# app/controllers/application_controller.rb
|
57
61
|
class ApplicationController < ActionController::Base
|
58
62
|
protect_from_forgery with: :exception
|
@@ -61,15 +65,12 @@ class ApplicationController < ActionController::Base
|
|
61
65
|
redirect_to 'http://www.example.com'
|
62
66
|
end
|
63
67
|
end
|
64
|
-
```
|
65
68
|
|
66
|
-
Your controller spec
|
67
|
-
```ruby
|
68
69
|
# spec/controllers/application_controller_spec.rb
|
69
70
|
require "spec_helper"
|
70
71
|
|
71
72
|
describe ApplicationController, type: :controller do
|
72
|
-
|
73
|
+
shadow_controller
|
73
74
|
|
74
75
|
it "#redirect_somewhere" do
|
75
76
|
get :redirect_somewhere
|
@@ -79,7 +80,7 @@ end
|
|
79
80
|
|
80
81
|
```
|
81
82
|
|
82
|
-
Without the
|
83
|
+
Without the shadow_controller method (above) or extra configurations, this test would have failed with the following error
|
83
84
|
|
84
85
|
```ruby
|
85
86
|
1) ApplicationController #redirect_somewhere
|
data/lib/shadow_controller.rb
CHANGED
data/shadow_controller.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["milesstanfield@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{An RSpec helper that makes testing your rails ApplicationController a cool breeze.}
|
13
|
-
spec.description = %q{Testing your ApplicationController often requires using the AnonymousController and drawing custom routes. This helper does all that for you and prevents you from having to update your AnonymousController whenever you make a change to the ApplicationController.'}
|
13
|
+
spec.description = %q{Testing your ApplicationController with RSpec often requires using the AnonymousController and drawing custom routes. This helper does all that for you and prevents you from having to update your AnonymousController whenever you make a change to the ApplicationController.'}
|
14
14
|
spec.homepage = "https://github.com/milesstanfield/shadow_controller"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shadow_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Stanfield
|
@@ -52,9 +52,10 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
description: Testing your ApplicationController often requires using the
|
56
|
-
and drawing custom routes. This helper does all that for you
|
57
|
-
having to update your AnonymousController whenever you make
|
55
|
+
description: Testing your ApplicationController with RSpec often requires using the
|
56
|
+
AnonymousController and drawing custom routes. This helper does all that for you
|
57
|
+
and prevents you from having to update your AnonymousController whenever you make
|
58
|
+
a change to the ApplicationController.'
|
58
59
|
email:
|
59
60
|
- milesstanfield@gmail.com
|
60
61
|
executables: []
|