rspec-cells 0.3.2 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +26 -0
- data/CHANGES.md +17 -0
- data/Gemfile +1 -3
- data/README.md +26 -8
- data/lib/rspec/cells/example_group.rb +20 -13
- data/lib/rspec/cells/version.rb +1 -1
- data/lib/rspec/cells.rb +1 -0
- data/rspec-cells.gemspec +15 -4
- data/spec/cells/cell_spec_spec.rb +0 -1
- metadata +40 -16
- data/.travis.yml +0 -12
- data/Appraisals +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 44801a75a08a49bc26e5a72b126199b14b08a24e5b5ce6c0998d51468d7f9ccb
|
4
|
+
data.tar.gz: f291ede5db682f504d1716ca2dbd8b3ed189106765842b198f81945a27701009
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a7f4a5152c5cf6f6222c33d7a7958c204a71febfc44d2a6a05e7b8fcdbbfad1e7608638275bda6c98f3d1e9ff1a78b68a284c7f7a96f7b0c50f5d5d5c2109f
|
7
|
+
data.tar.gz: e9c08212997383bc3e37d05311417113a66afff461ab77257fd3410516a691069c96f0cc30759107ddf1e37e9858bfa756aed9114590562d053385921188372f
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
- push
|
4
|
+
- pull_request
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: Test (Ruby ${{ matrix.ruby }})
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby:
|
11
|
+
- '2.3'
|
12
|
+
- '2.4'
|
13
|
+
- '2.5'
|
14
|
+
- '2.6'
|
15
|
+
- '2.7'
|
16
|
+
- '3.0'
|
17
|
+
- 'head'
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
- uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
bundler-cache: true
|
25
|
+
- name: RSpec
|
26
|
+
run: bundle exec rake spec
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# 0.3.6
|
2
|
+
|
3
|
+
* Support Ruby 3.
|
4
|
+
|
5
|
+
# 0.3.5
|
6
|
+
|
7
|
+
* Avoid global configuration change (#86)
|
8
|
+
* Support rspec-rails 4.x. This is required for Rails 6 (#88)
|
9
|
+
|
10
|
+
# 0.3.4
|
11
|
+
|
12
|
+
* Allow Cells 4.1.
|
13
|
+
|
14
|
+
# 0.3.3
|
15
|
+
|
16
|
+
* Maintenance release to make it work with rspec-rails 3.3.
|
17
|
+
|
1
18
|
# 0.3.2
|
2
19
|
|
3
20
|
* Bugfix: In 0.3.1, I included cells specific `#controller` code into every Rspec example. Thanks to @psynix for spotting this within minutes.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ _Spec your Cells._
|
|
4
4
|
|
5
5
|
This plugin allows you to spec your cells with RSpec.
|
6
6
|
|
7
|
-
Cells is Rails' popular [view components framework(http://github.com/apotonick/cells).
|
7
|
+
Cells is Rails' popular [view components framework](http://github.com/apotonick/cells).
|
8
8
|
|
9
9
|
# Installation
|
10
10
|
|
@@ -20,12 +20,14 @@ Note: In case you're still using **Cells 3**, [go here](https://github.com/apoto
|
|
20
20
|
|
21
21
|
# Usage
|
22
22
|
|
23
|
-
Simply put all your specs in the
|
23
|
+
Simply put all your specs in the `spec/cells` directory or add `type: :cell` to the describe block.
|
24
24
|
However, let the cell generator do that for you!
|
25
25
|
|
26
|
-
|
26
|
+
```
|
27
|
+
rails g rspec:cell comment show
|
28
|
+
```
|
27
29
|
|
28
|
-
will create an exemplary
|
30
|
+
will create an exemplary `spec/cells/comment_cell_spec.rb` for you.
|
29
31
|
|
30
32
|
|
31
33
|
# API
|
@@ -33,13 +35,27 @@ will create an exemplary <tt>spec/cells/blog_post_cell_spec.rb</tt> for you.
|
|
33
35
|
To invoke rendering of a cell you use the exact same API as in your application.
|
34
36
|
|
35
37
|
```ruby
|
36
|
-
|
37
|
-
|
38
|
+
describe CommentCell do
|
39
|
+
it "renders comment" do
|
40
|
+
expect(cell(:comment).call).to have_content "Really Great!"
|
41
|
+
end
|
38
42
|
end
|
39
43
|
```
|
40
44
|
|
41
45
|
As you can see, it is nothing more than using `#cell` or `#concept`, invoke the default state using `#call` (or any other state with `call(:other_state)`) and use Rspecs and Capybara's matchers.
|
42
46
|
|
47
|
+
|
48
|
+
## URL helpers
|
49
|
+
|
50
|
+
If your cells use helpers with controller dependency, you need to specify a controller to use in your test.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
describe CommentCell do
|
54
|
+
controller CommentsController
|
55
|
+
```
|
56
|
+
|
57
|
+
Excuse the clumsiness, but this is done wrong in Rails and not Cells' fault.
|
58
|
+
|
43
59
|
# Running Specs
|
44
60
|
|
45
61
|
Run your examples with
|
@@ -50,20 +66,22 @@ rake spec:cells
|
|
50
66
|
|
51
67
|
# More docs
|
52
68
|
|
53
|
-
All the docs about testing can be found on the [Trailblazer project page](http://
|
69
|
+
All the docs about testing can be found on the [Trailblazer project page](http://trailblazer.to/gems/cells/testing.html).
|
54
70
|
|
55
|
-
|
71
|
+
# Test cells with caching
|
56
72
|
|
57
73
|
By default your code for caching code is not run if you set <tt>ActionController::Base.perform_caching = false</tt>
|
58
74
|
That's a reasonable default but you might want to increase coverage by running caching code at least once.
|
59
75
|
Here is an example:
|
60
76
|
|
77
|
+
```ruby
|
61
78
|
describe SomeCell do
|
62
79
|
describe 'caching' do
|
63
80
|
enable_cell_caching!
|
64
81
|
# Code for testing...
|
65
82
|
end
|
66
83
|
end
|
84
|
+
```
|
67
85
|
|
68
86
|
|
69
87
|
# Contributors
|
@@ -9,10 +9,10 @@ module RSpec
|
|
9
9
|
|
10
10
|
attr_reader :routes
|
11
11
|
|
12
|
-
def method_missing(method, *args, &block)
|
12
|
+
def method_missing(method, *args, **kwargs, &block)
|
13
13
|
# Send the route helpers to the application router.
|
14
14
|
if route_defined?(method)
|
15
|
-
controller.send(method, *args, &block)
|
15
|
+
controller.send(method, *args, **kwargs, &block)
|
16
16
|
else
|
17
17
|
super
|
18
18
|
end
|
@@ -33,25 +33,32 @@ module RSpec
|
|
33
33
|
|
34
34
|
before do # called before every it.
|
35
35
|
@routes = ::Rails.application.routes
|
36
|
-
ActionController::Base.allow_forgery_protection = false
|
37
36
|
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
around do |example|
|
39
|
+
begin
|
40
|
+
old_value = ActionController::Base.allow_forgery_protection
|
41
|
+
ActionController::Base.allow_forgery_protection = false
|
42
42
|
|
43
|
+
example.run
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
@controller_class
|
45
|
+
ensure
|
46
|
+
ActionController::Base.allow_forgery_protection = old_value
|
47
|
+
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
# add Example::controller and ::controller_class.
|
51
|
+
extend RSpec::Cells::ExampleGroup::Controller
|
52
|
+
let(:controller_class) {}
|
53
|
+
let(:controller) { controller_for(controller_class) }
|
53
54
|
end
|
54
55
|
|
56
|
+
|
57
|
+
module Controller
|
58
|
+
def controller(name) # DSL for test, e.g. `controller SongsController`.
|
59
|
+
let (:controller_class) { name }
|
60
|
+
end
|
61
|
+
end
|
55
62
|
end
|
56
63
|
end
|
57
64
|
end
|
data/lib/rspec/cells/version.rb
CHANGED
data/lib/rspec/cells.rb
CHANGED
data/rspec-cells.gemspec
CHANGED
@@ -7,17 +7,28 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Nick Sutterer"]
|
9
9
|
s.email = ["apotonick@gmail.com"]
|
10
|
-
s.homepage = "
|
10
|
+
s.homepage = "https://github.com/trailblazer/rspec-cells"
|
11
11
|
s.summary = %q{Spec your cells.}
|
12
12
|
s.description = %q{Use render_cell in your specs.}
|
13
13
|
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.metadata = {
|
16
|
+
"bug_tracker_uri" => "https://github.com/trailblazer/rspec-cells/issues",
|
17
|
+
"changelog_uri" => "https://github.com/trailblazer/rspec-cells/blob/master/CHANGES.md",
|
18
|
+
"documentation_uri" => "https://www.rubydoc.info/gems/rspec-cells/#{s.version}",
|
19
|
+
"homepage_uri" => s.homepage,
|
20
|
+
"source_code_uri" => "https://github.com/trailblazer/rspec-cells/tree/v#{s.version}",
|
21
|
+
"wiki_uri" => "https://github.com/trailblazer/rspec-cells/wiki",
|
22
|
+
}
|
23
|
+
|
14
24
|
s.files = `git ls-files`.split("\n")
|
15
25
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
26
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
27
|
s.require_paths = ["lib"]
|
18
28
|
|
19
|
-
s.add_runtime_dependency 'rspec-rails', '
|
20
|
-
s.add_runtime_dependency "cells", "
|
29
|
+
s.add_runtime_dependency 'rspec-rails', '< 6.0'
|
30
|
+
s.add_runtime_dependency "cells", ">= 4.0.0", "< 6.0.0"
|
31
|
+
|
21
32
|
|
22
|
-
|
33
|
+
s.add_development_dependency "capybara" # FIXME: please make test for Capybara run.
|
23
34
|
end
|
metadata
CHANGED
@@ -1,43 +1,63 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-cells
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cells
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.0.0
|
33
|
+
version: 4.0.0
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 6.0.0
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 4.0.0
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 6.0.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: capybara
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
39
59
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
60
|
+
version: '0'
|
41
61
|
description: Use render_cell in your specs.
|
42
62
|
email:
|
43
63
|
- apotonick@gmail.com
|
@@ -45,9 +65,8 @@ executables: []
|
|
45
65
|
extensions: []
|
46
66
|
extra_rdoc_files: []
|
47
67
|
files:
|
68
|
+
- ".github/workflows/ci.yml"
|
48
69
|
- ".gitignore"
|
49
|
-
- ".travis.yml"
|
50
|
-
- Appraisals
|
51
70
|
- CHANGES.md
|
52
71
|
- Gemfile
|
53
72
|
- MIT-LICENSE
|
@@ -67,10 +86,16 @@ files:
|
|
67
86
|
- spec/cells/cell_generator_spec.rb
|
68
87
|
- spec/cells/cell_spec_spec.rb
|
69
88
|
- spec/spec_helper.rb
|
70
|
-
homepage:
|
89
|
+
homepage: https://github.com/trailblazer/rspec-cells
|
71
90
|
licenses:
|
72
91
|
- MIT
|
73
|
-
metadata:
|
92
|
+
metadata:
|
93
|
+
bug_tracker_uri: https://github.com/trailblazer/rspec-cells/issues
|
94
|
+
changelog_uri: https://github.com/trailblazer/rspec-cells/blob/master/CHANGES.md
|
95
|
+
documentation_uri: https://www.rubydoc.info/gems/rspec-cells/0.3.6
|
96
|
+
homepage_uri: https://github.com/trailblazer/rspec-cells
|
97
|
+
source_code_uri: https://github.com/trailblazer/rspec-cells/tree/v0.3.6
|
98
|
+
wiki_uri: https://github.com/trailblazer/rspec-cells/wiki
|
74
99
|
post_install_message:
|
75
100
|
rdoc_options: []
|
76
101
|
require_paths:
|
@@ -86,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
111
|
- !ruby/object:Gem::Version
|
87
112
|
version: '0'
|
88
113
|
requirements: []
|
89
|
-
|
90
|
-
rubygems_version: 2.2.2
|
114
|
+
rubygems_version: 3.0.8
|
91
115
|
signing_key:
|
92
116
|
specification_version: 4
|
93
117
|
summary: Spec your cells.
|
data/.travis.yml
DELETED