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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55def613384ef8a44b7c5fb4cf793577bacb69d3
4
- data.tar.gz: fc172ea1d6eb0c1a221c119324e2b933366a9734
3
+ metadata.gz: 0e019ba6efdfdcfe0ff0c1986865b82fb3524573
4
+ data.tar.gz: 5d5db4fa41683f0c908e24a1509acb4cd13f796a
5
5
  SHA512:
6
- metadata.gz: 55a973fe38318f3a0513c666817919ef4c0b3ffbc8a4588ea1554e0ff5f56297542574d86720001bf207602121a24bde74626b1b260bf096b37b04e98db8d978
7
- data.tar.gz: 7db6d783f93fc11f3d4500b70d574b5eac77c02ff9e4d3be06a91270d71d14de2bf1a48af44fced78d21b0b3622fea4b47ab930554bde7cce8d9ead407f5c906
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
- Include the ShadowController in your RSpec configure.
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
- Now cast the shadow helper in your spec
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
- cast_shadow ApplicationController
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
- cast_shadow ApplicationController
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 ShadowController helper in use above or any other configurations, this test would have failed with the following error
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
@@ -1,7 +1,8 @@
1
1
  require "shadow_controller/version"
2
2
 
3
3
  module ShadowController
4
- def cast_shadow(controller)
4
+ def shadow_controller
5
+ controller = self.described_class
5
6
  raise_misuse if misused? controller
6
7
  mock controller
7
8
  draw_routes controller
@@ -1,3 +1,3 @@
1
1
  module ShadowController
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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.0
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 AnonymousController
56
- and drawing custom routes. This helper does all that for you and prevents you from
57
- having to update your AnonymousController whenever you make a change to the ApplicationController.'
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: []