rspec-cells 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.textile +4 -0
- data/README.rdoc +15 -1
- data/lib/rspec/cells.rb +1 -1
- data/lib/rspec/{rails/example → cells}/cell_example_group.rb +14 -4
- data/lib/rspec/cells/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17af3de29745c3cc54fcf49748b91c5a2c076671
|
4
|
+
data.tar.gz: e85b1253250341cc536e7f691bed8b98eaa95bc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54c471f5c5ab63615d5a46ab4866b02f4c8d839e6df79340bc0dabed61d21b123cc6ef289bf03148c972cc2da3856c65be4f2c57446119041536e3d21c2a180c
|
7
|
+
data.tar.gz: 03854804f36c54717cbd8f8efb335b62ce25554880628c9b3a37f5fbb60c54d180c5657aab47f84dd400c59fd5d5758c92fc1a53b4f27c535eb817023d083ed2
|
data/CHANGES.textile
CHANGED
data/README.rdoc
CHANGED
@@ -27,6 +27,8 @@ will create an exemplary <tt>spec/cells/blog_post_cell_spec.rb</tt> for you.
|
|
27
27
|
|
28
28
|
== API
|
29
29
|
|
30
|
+
=== Old API
|
31
|
+
|
30
32
|
In your specs you can use +render_cell+ to assert the rendered markup (or whatever your state is supposed to do). This goes fine with Webrat matchers.
|
31
33
|
|
32
34
|
it "renders posts count" do
|
@@ -44,6 +46,18 @@ You can create a cell instance using the +cell+ method, and then render afterwar
|
|
44
46
|
|
45
47
|
After preparing the instance you can use +render_state+ for triggering the state.
|
46
48
|
|
49
|
+
|
50
|
+
=== View Models
|
51
|
+
|
52
|
+
With the introduction of cells [view models]() you get a slightly different API for your specs (which is identical to your app's one).
|
53
|
+
|
54
|
+
it "renders empty posts list" do
|
55
|
+
posts = cell(:posts).count.should should have_css "#comment_new .flag", visible: true)
|
56
|
+
end
|
57
|
+
|
58
|
+
It's pretty simple, you use `#cell` to instantiate a view model instance and then call the state method on it.
|
59
|
+
|
60
|
+
|
47
61
|
== Capybara
|
48
62
|
|
49
63
|
If you want Capybara's string matchers be sure to bundle at least capybara +0.4.1+ in your Gemfile.
|
@@ -54,7 +68,7 @@ If you want Capybara's string matchers be sure to bundle at least capybara +0.4.
|
|
54
68
|
|
55
69
|
In order to make the cells test generator work properly, capybara needs to be in both groups.
|
56
70
|
|
57
|
-
|
71
|
+
|
58
72
|
You can then use capybara's matchers in your cell spec.
|
59
73
|
|
60
74
|
describe PostsCell do
|
data/lib/rspec/cells.rb
CHANGED
@@ -38,12 +38,22 @@ module RSpec::Rails
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def cell(*args)
|
41
|
-
|
41
|
+
Content.new(super)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
|
45
|
+
# TODO: test if view model cell wrapping works (and normal dialect)
|
46
|
+
# test with both webrick and capybara
|
47
|
+
class Content
|
48
|
+
def initialize(cell)
|
49
|
+
@cell = cell
|
50
|
+
end
|
51
|
+
|
52
|
+
def method_missing(*args)
|
53
|
+
content = @cell.send(*args)
|
54
|
+
|
55
|
+
return Capybara.string(content) if content.is_a?(String)
|
56
|
+
content
|
47
57
|
end
|
48
58
|
end
|
49
59
|
end
|
data/lib/rspec/cells/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -70,9 +70,9 @@ files:
|
|
70
70
|
- lib/generators/rspec/templates/cell_spec.erb
|
71
71
|
- lib/rspec-cells.rb
|
72
72
|
- lib/rspec/cells.rb
|
73
|
+
- lib/rspec/cells/cell_example_group.rb
|
73
74
|
- lib/rspec/cells/tasks.rake
|
74
75
|
- lib/rspec/cells/version.rb
|
75
|
-
- lib/rspec/rails/example/cell_example_group.rb
|
76
76
|
- rspec-cells.gemspec
|
77
77
|
- spec/cells/cell_generator_spec.rb
|
78
78
|
- spec/cells/cell_spec_spec.rb
|
@@ -105,3 +105,4 @@ test_files:
|
|
105
105
|
- spec/cells/cell_generator_spec.rb
|
106
106
|
- spec/cells/cell_spec_spec.rb
|
107
107
|
- spec/spec_helper.rb
|
108
|
+
has_rdoc:
|