rails-controller-testing 1.0.0 → 1.0.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/README.md +13 -3
- data/lib/rails-controller-testing.rb +2 -21
- data/lib/rails/controller/testing.rb +25 -0
- data/lib/rails/controller/testing/railtie.rb +5 -0
- data/lib/rails/controller/testing/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1985518a366c6d03e6ee96cc506686ac0c2d965d
|
4
|
+
data.tar.gz: 97d894de1d866047e6b8fc0d6055b17f91f7d48c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54709c6e0bf1f97d9d35e8c613b6f7990a8e11541601b5f16296604d6a3b4e0ee2c86e6a7f4214bcbb54ecc0f5364bec7d670712a45d85694dbe3671062578ac
|
7
|
+
data.tar.gz: fb983705ffd31ccdc5d93c5b2ebcc478bc08cc2a2bde8d98a8c13068219879f4fbb5716012440de89c7f6323a129cdb2371d1aa37c8f43d3b14d75a776fdc7d4
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# Rails::Controller::Testing
|
2
2
|
|
3
|
-
[](https://travis-ci.org/rails/rails-controller-testing)
|
4
|
-
[](http://badge.fury.io/rb/rails-controller-testing)
|
5
|
-
|
6
3
|
This gem brings back `assigns` to your controller tests as well as `assert_template`
|
7
4
|
to both controller and integration tests.
|
8
5
|
|
@@ -43,6 +40,19 @@ RSpec.configure do |config|
|
|
43
40
|
end
|
44
41
|
```
|
45
42
|
|
43
|
+
## Outside Rails
|
44
|
+
|
45
|
+
For projects and gems using controller tests outside of a Rails application,
|
46
|
+
invoke the `Rails::Controller::Testing.install` method inside your test suite
|
47
|
+
setup to include the required modules on controller test cases.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
# test/test_helper.rb
|
51
|
+
|
52
|
+
require 'rails-controller-testing'
|
53
|
+
Rails::Controller::Testing.install
|
54
|
+
```
|
55
|
+
|
46
56
|
## Usage
|
47
57
|
|
48
58
|
### assigns
|
@@ -1,22 +1,3 @@
|
|
1
|
-
require '
|
2
|
-
require 'rails/controller/testing/
|
3
|
-
require 'rails/controller/testing/integration'
|
4
|
-
require 'rails/controller/testing/template_assertions'
|
1
|
+
require 'rails/controller/testing'
|
2
|
+
require 'rails/controller/testing/railtie' if defined?(Rails::Railtie)
|
5
3
|
require 'rails/controller/testing/version'
|
6
|
-
|
7
|
-
class Rails::Controller::Testing::Railtie < Rails::Railtie
|
8
|
-
initializer "rails_controller_testing" do
|
9
|
-
ActiveSupport.on_load(:action_controller) do
|
10
|
-
ActionController::TestCase.include Rails::Controller::Testing::TestProcess
|
11
|
-
ActionController::TestCase.include Rails::Controller::Testing::TemplateAssertions
|
12
|
-
|
13
|
-
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TemplateAssertions
|
14
|
-
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::Integration
|
15
|
-
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TestProcess
|
16
|
-
end
|
17
|
-
|
18
|
-
ActiveSupport.on_load(:action_view) do
|
19
|
-
ActionView::TestCase.include Rails::Controller::Testing::TemplateAssertions
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'active_support/lazy_load_hooks'
|
2
|
+
require 'rails/controller/testing/test_process'
|
3
|
+
require 'rails/controller/testing/integration'
|
4
|
+
require 'rails/controller/testing/template_assertions'
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Controller
|
8
|
+
module Testing
|
9
|
+
def self.install
|
10
|
+
ActiveSupport.on_load(:action_controller) do
|
11
|
+
ActionController::TestCase.include Rails::Controller::Testing::TestProcess
|
12
|
+
ActionController::TestCase.include Rails::Controller::Testing::TemplateAssertions
|
13
|
+
|
14
|
+
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TemplateAssertions
|
15
|
+
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::Integration
|
16
|
+
ActionDispatch::IntegrationTest.include Rails::Controller::Testing::TestProcess
|
17
|
+
end
|
18
|
+
|
19
|
+
ActiveSupport.on_load(:action_view) do
|
20
|
+
ActionView::TestCase.include Rails::Controller::Testing::TemplateAssertions
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-controller-testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rails Core Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -90,7 +90,9 @@ files:
|
|
90
90
|
- README.md
|
91
91
|
- Rakefile
|
92
92
|
- lib/rails-controller-testing.rb
|
93
|
+
- lib/rails/controller/testing.rb
|
93
94
|
- lib/rails/controller/testing/integration.rb
|
95
|
+
- lib/rails/controller/testing/railtie.rb
|
94
96
|
- lib/rails/controller/testing/template_assertions.rb
|
95
97
|
- lib/rails/controller/testing/test_process.rb
|
96
98
|
- lib/rails/controller/testing/version.rb
|