rspec-cells 0.3.3 → 0.3.7
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 +26 -8
- data/lib/rspec/cells/version.rb +1 -1
- data/rspec-cells.gemspec +13 -3
- metadata +29 -19
- 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: 411fd1daa1989c9ad0017a8a01d3bf0089e7b7f194a44ac791ea85d97f4fc65b
|
4
|
+
data.tar.gz: 915dd9405bc42459a51d32d25222253c0094601118dd0c63de29a8445290574e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5beb40bbd81487169f095ac3f12d0ba3989633bb0832be2f58b23b8e6f3a092bdbce17c51dc502955ab62f7447cd647915ac125aa87bfabf41df9ae0a00c7c3e
|
7
|
+
data.tar.gz: fbae34565adfd293b82b2ad53b3355eac208b061f19610d31eb1b326b8f8eb0fbd7c8e32bfd52d8a2b98d7a0f49892471ab174c182b9c656987696fc31575c6c
|
@@ -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.7
|
2
|
+
|
3
|
+
* Fix method signature for ruby <= 2.6
|
4
|
+
|
5
|
+
# 0.3.6
|
6
|
+
|
7
|
+
* Support Ruby 3.
|
8
|
+
|
9
|
+
# 0.3.5
|
10
|
+
|
11
|
+
* Avoid global configuration change (#86)
|
12
|
+
* Support rspec-rails 4.x. This is required for Rails 6 (#88)
|
13
|
+
|
14
|
+
# 0.3.4
|
15
|
+
|
16
|
+
* Allow Cells 4.1.
|
17
|
+
|
1
18
|
# 0.3.3
|
2
19
|
|
3
20
|
* Maintenance release to make it work with rspec-rails 3.3.
|
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,12 +9,19 @@ module RSpec
|
|
9
9
|
|
10
10
|
attr_reader :routes
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0')
|
13
|
+
def method_missing(method, *args, **kwargs, &block)
|
14
|
+
# Send the route helpers to the application router.
|
15
|
+
return super unless route_defined?(method)
|
16
|
+
|
17
|
+
controller.send(method, *args, **kwargs, &block)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
def method_missing(method, *args, &block)
|
21
|
+
# Send the route helpers to the application router.
|
22
|
+
return super unless route_defined?(method)
|
23
|
+
|
15
24
|
controller.send(method, *args, &block)
|
16
|
-
else
|
17
|
-
super
|
18
25
|
end
|
19
26
|
end
|
20
27
|
|
@@ -33,13 +40,24 @@ module RSpec
|
|
33
40
|
|
34
41
|
before do # called before every it.
|
35
42
|
@routes = ::Rails.application.routes
|
36
|
-
|
43
|
+
end
|
44
|
+
|
45
|
+
around do |example|
|
46
|
+
begin
|
47
|
+
old_value = ActionController::Base.allow_forgery_protection
|
48
|
+
ActionController::Base.allow_forgery_protection = false
|
49
|
+
|
50
|
+
example.run
|
51
|
+
|
52
|
+
ensure
|
53
|
+
ActionController::Base.allow_forgery_protection = old_value
|
54
|
+
end
|
37
55
|
end
|
38
56
|
|
39
57
|
# add Example::controller and ::controller_class.
|
40
58
|
extend RSpec::Cells::ExampleGroup::Controller
|
41
|
-
let
|
42
|
-
let
|
59
|
+
let(:controller_class) {}
|
60
|
+
let(:controller) { controller_for(controller_class) }
|
43
61
|
end
|
44
62
|
|
45
63
|
|
data/lib/rspec/cells/version.rb
CHANGED
data/rspec-cells.gemspec
CHANGED
@@ -7,17 +7,27 @@ 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"
|
21
31
|
|
22
32
|
|
23
33
|
s.add_development_dependency "capybara" # FIXME: please make test for Capybara run.
|
metadata
CHANGED
@@ -1,43 +1,49 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-17 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
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.0.0
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
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
|
+
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 6.0.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: capybara
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,9 +65,8 @@ executables: []
|
|
59
65
|
extensions: []
|
60
66
|
extra_rdoc_files: []
|
61
67
|
files:
|
68
|
+
- ".github/workflows/ci.yml"
|
62
69
|
- ".gitignore"
|
63
|
-
- ".travis.yml"
|
64
|
-
- Appraisals
|
65
70
|
- CHANGES.md
|
66
71
|
- Gemfile
|
67
72
|
- MIT-LICENSE
|
@@ -81,11 +86,17 @@ files:
|
|
81
86
|
- spec/cells/cell_generator_spec.rb
|
82
87
|
- spec/cells/cell_spec_spec.rb
|
83
88
|
- spec/spec_helper.rb
|
84
|
-
homepage:
|
89
|
+
homepage: https://github.com/trailblazer/rspec-cells
|
85
90
|
licenses:
|
86
91
|
- MIT
|
87
|
-
metadata:
|
88
|
-
|
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.7
|
96
|
+
homepage_uri: https://github.com/trailblazer/rspec-cells
|
97
|
+
source_code_uri: https://github.com/trailblazer/rspec-cells/tree/v0.3.7
|
98
|
+
wiki_uri: https://github.com/trailblazer/rspec-cells/wiki
|
99
|
+
post_install_message:
|
89
100
|
rdoc_options: []
|
90
101
|
require_paths:
|
91
102
|
- lib
|
@@ -100,9 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
111
|
- !ruby/object:Gem::Version
|
101
112
|
version: '0'
|
102
113
|
requirements: []
|
103
|
-
|
104
|
-
|
105
|
-
signing_key:
|
114
|
+
rubygems_version: 3.0.8
|
115
|
+
signing_key:
|
106
116
|
specification_version: 4
|
107
117
|
summary: Spec your cells.
|
108
118
|
test_files:
|
data/.travis.yml
DELETED