rspec-cells 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/Gemfile +0 -2
- data/README.md +25 -7
- data/lib/rspec/cells/version.rb +1 -1
- data/rspec-cells.gemspec +1 -1
- metadata +14 -13
- data/Appraisals +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c95f2e0628ef02beab2e9f9c58a48acce13ab646
|
4
|
+
data.tar.gz: 966250024a3c40d9a3b5fa7b0470edcd2058e440
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a7c9fbce4af8ec69ea1c3675a50baecc5d3798dcef1e9d060b97878c8e047bf0907450de48a73e0824a66bfe969beb4582e331ef28b99ac603f7f264f6319f
|
7
|
+
data.tar.gz: d15e488b599b16cae99454966b96f518c5bd130c76277d25262d5bfe113496ec0aafb8d9b792972e88083ab82562c3c338309608fde96effd706e34eacd905a2
|
data/CHANGES.md
CHANGED
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
|
@@ -52,18 +68,20 @@ rake spec:cells
|
|
52
68
|
|
53
69
|
All the docs about testing can be found on the [Trailblazer project page](http://trailblazerb.org/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
|
data/lib/rspec/cells/version.rb
CHANGED
data/rspec-cells.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
19
|
s.add_runtime_dependency 'rspec-rails', '~> 3.2'
|
20
|
-
s.add_runtime_dependency "cells", "
|
20
|
+
s.add_runtime_dependency "cells", ">= 4.0.0", "< 6.0.0"
|
21
21
|
|
22
22
|
|
23
23
|
s.add_development_dependency "capybara" # FIXME: please make test for Capybara run.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
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: 2016-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-rails
|
@@ -28,16 +28,22 @@ dependencies:
|
|
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
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.0.0
|
43
|
+
version: 4.0.0
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 6.0.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: capybara
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,7 +67,6 @@ extra_rdoc_files: []
|
|
61
67
|
files:
|
62
68
|
- ".gitignore"
|
63
69
|
- ".travis.yml"
|
64
|
-
- Appraisals
|
65
70
|
- CHANGES.md
|
66
71
|
- Gemfile
|
67
72
|
- MIT-LICENSE
|
@@ -101,12 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
106
|
version: '0'
|
102
107
|
requirements: []
|
103
108
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.4.8
|
105
110
|
signing_key:
|
106
111
|
specification_version: 4
|
107
112
|
summary: Spec your cells.
|
108
|
-
test_files:
|
109
|
-
- spec/cells/caching_spec.rb
|
110
|
-
- spec/cells/cell_generator_spec.rb
|
111
|
-
- spec/cells/cell_spec_spec.rb
|
112
|
-
- spec/spec_helper.rb
|
113
|
+
test_files: []
|