rspec-cells 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1564be294c56e4d6d9ec37b5d255b1fac024baa9
4
+ data.tar.gz: 88a422c60cea1dbe0b8913795f12dcb73cd5f60f
5
+ SHA512:
6
+ metadata.gz: ca0dfebdf804751120b5eea100cb3bdc19844f637443f334bd55e451a59a329aeb3b66b008e7c3a128010ec80dd2af12db09918dec05766b99d8e42ded690b87
7
+ data.tar.gz: 6ba7cdb2edaa392b0eef00258fa775bbc88dd0ff779815af47486cdeedee2a59233419b6874bb5aeaae57531b275abc75b2a868a867900aeb0eceb81e2be1670
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
- rvm: 1.9.2
2
- script: "bundle exec rspec -f documentation"
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
3
4
  notifications:
4
5
  irc: "irc.freenode.org#cells"
data/CHANGES.textile CHANGED
@@ -1,10 +1,16 @@
1
+ h2. 0.1.8
2
+
3
+ * Make @render_state@ return a Capybara string so it gets assertable.
4
+
5
+ h2. 0.1.7
6
+
1
7
  h2. 0.1.6
2
8
 
3
9
  * Minor internal fixes.
4
10
 
5
11
  h2. 0.1.5
6
12
 
7
- * Fixed generated test for namespaced cells.
13
+ * Fixed generated test for namespaced cells.
8
14
 
9
15
  h2. 0.1.4
10
16
 
@@ -23,24 +29,24 @@ h2. 0.1.1
23
29
  * Fixed indentation in generator. Thanks to Richard Huang [flyerhzm].
24
30
 
25
31
  h2. 0.1.0
26
-
32
+
27
33
  h3. Changes
28
34
  * Removed @ViewAssigns@. Maintenance Release.
29
35
 
30
36
  h2. 0.0.5
31
-
37
+
32
38
  h3. Changes
33
39
  * Works with RSpec-2.6 now, too.
34
40
  * We no longer provide our own Capybara string matchers but delegate to @Capybara.string@. If you ever used the @==@ equality check, this won't work anymore. As a tradeoff, you get all string matchers Capybara comes up with, making rspec-cells forward-compatible.
35
41
 
36
42
 
37
43
  h2. 0.0.4
38
-
44
+
39
45
  h3. Changes
40
46
  * Use Capybara's string matchers in your specs now (if you like)!
41
47
 
42
48
 
43
49
  h2. 0.0.2
44
-
50
+
45
51
  h3. Bugfixes
46
52
  * Using a Railtie to correctly load rspec-cells. Caused a dependency problem with capybara before. Thanks to Steve Sloan [CodeMonkeySteve] for fixing and Brandon Dimcheff [bdimcheff] for debugging.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem "rails", "3.2.12"
data/README.rdoc CHANGED
@@ -10,7 +10,7 @@ Cells is Rails' popular {view components framework}[http://github.com/apotonick/
10
10
 
11
11
  = Installation
12
12
 
13
- This gem runs with RSpec2 and Rails 3.x, so just add it to your app's +Gemfile+.
13
+ This gem runs with RSpec2 and Rails >= 3.x, so just add it to your app's +Gemfile+.
14
14
 
15
15
  group :test do
16
16
  gem "rspec-cells"
@@ -24,16 +24,26 @@ Simply put all your specs in the <tt>spec/cells</tt> directory. However, let the
24
24
 
25
25
  will create an exemplary <tt>spec/cells/blog_post_cell_spec.rb</tt> for you.
26
26
 
27
- == Webrat
28
27
 
29
- Webrat matchers just work as you might have expected - here is how a simple spec could look like.
28
+ == API
30
29
 
31
- describe PostsCell do
32
- it "should render the posts count" do
33
- render_cell(:posts, :count).should have_selector("p", :content => "4 posts!")
34
- end
30
+ 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
+
32
+ it "renders posts count" do
33
+ render_cell(:posts, :count).should have_selector("p", :content => "4 posts!")
34
+ end
35
+
36
+ You can create a cell instance using the +cell+ method, and then render afterwards. This is helpful when you're planning to stub things or if you need to pass arguments to the cell constructor.
37
+
38
+ it "renders empty posts list" do
39
+ posts = cell(:posts)
40
+ posts.stub(:recent_posts).and_return([])
41
+
42
+ posts.render_state(:count).should have_selector("p", :content => "No posts!")
35
43
  end
36
44
 
45
+ After preparing the instance you can use +render_state+ for triggering the state.
46
+
37
47
  == Capybara
38
48
 
39
49
  If you want Capybara's string matchers be sure to bundle at least capybara +0.4.1+ in your Gemfile.
@@ -1,6 +1,6 @@
1
- module RSpec # :nodoc:
2
- module Cells # :nodoc:
3
- VERSION = '0.1.7'
1
+ module RSpec
2
+ module Cells
3
+ VERSION = '0.1.8'
4
4
  end
5
5
  end
6
6
 
@@ -36,6 +36,16 @@ module RSpec::Rails
36
36
  def render_cell(*args)
37
37
  Capybara.string super
38
38
  end
39
+
40
+ def cell(*args)
41
+ CapybaraOutputCell.new(super)
42
+ end
43
+
44
+ class CapybaraOutputCell < SimpleDelegator
45
+ def render_state(*args)
46
+ Capybara.string(__getobj__.render_state(*args))
47
+ end
48
+ end
39
49
  end
40
50
 
41
51
  attr_reader :controller, :routes
@@ -3,7 +3,7 @@ require 'cells'
3
3
 
4
4
  class DummyCell < Cell::Base
5
5
  def show
6
- "I'm Dummy."
6
+ "<p>I'm Dummy.</p>"
7
7
  end
8
8
 
9
9
  def update(what)
@@ -27,7 +27,7 @@ module RSpec::Rails
27
27
 
28
28
  describe "#render_cell" do
29
29
  it "renders a state" do
30
- group.new.render_cell(:dummy, :show).should == "I'm Dummy."
30
+ group.new.render_cell(:dummy, :show).should == "<p>I'm Dummy.</p>"
31
31
  end
32
32
 
33
33
  it "allows passing state args" do
@@ -39,6 +39,11 @@ module RSpec::Rails
39
39
  group.new.cell(:dummy).should be_kind_of(DummyCell)
40
40
  end
41
41
 
42
+ # FIXME: could anyone make capybara/rails work in these tests?
43
+ # it "allows using matchers with #render_state" do
44
+ # cell(:dummy).render_state(:show).should have_selector("p")
45
+ # end
46
+
42
47
  context "as a test writer" do
43
48
  include CellExampleGroup
44
49
 
metadata CHANGED
@@ -1,22 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
5
- prerelease:
4
+ version: 0.1.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nick Sutterer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-08 00:00:00.000000000 Z
11
+ date: 2013-11-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  - - <
@@ -25,9 +23,8 @@ dependencies:
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - '>='
31
28
  - !ruby/object:Gem::Version
32
29
  version: '3.0'
33
30
  - - <
@@ -36,7 +33,6 @@ dependencies:
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: rspec-rails
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
37
  - - ~>
42
38
  - !ruby/object:Gem::Version
@@ -44,7 +40,6 @@ dependencies:
44
40
  type: :runtime
45
41
  prerelease: false
46
42
  version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
43
  requirements:
49
44
  - - ~>
50
45
  - !ruby/object:Gem::Version
@@ -52,7 +47,6 @@ dependencies:
52
47
  - !ruby/object:Gem::Dependency
53
48
  name: cells
54
49
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
51
  - - ~>
58
52
  - !ruby/object:Gem::Version
@@ -60,7 +54,6 @@ dependencies:
60
54
  type: :runtime
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
57
  requirements:
65
58
  - - ~>
66
59
  - !ruby/object:Gem::Version
@@ -92,26 +85,25 @@ files:
92
85
  - spec/spec_helper.rb
93
86
  homepage: http://rubygems.org/gems/rspec-cells
94
87
  licenses: []
88
+ metadata: {}
95
89
  post_install_message:
96
90
  rdoc_options: []
97
91
  require_paths:
98
92
  - lib
99
93
  required_ruby_version: !ruby/object:Gem::Requirement
100
- none: false
101
94
  requirements:
102
- - - ! '>='
95
+ - - '>='
103
96
  - !ruby/object:Gem::Version
104
97
  version: '0'
105
98
  required_rubygems_version: !ruby/object:Gem::Requirement
106
- none: false
107
99
  requirements:
108
- - - ! '>='
100
+ - - '>='
109
101
  - !ruby/object:Gem::Version
110
102
  version: '0'
111
103
  requirements: []
112
104
  rubyforge_project: rspec-cells
113
- rubygems_version: 1.8.24
105
+ rubygems_version: 2.0.3
114
106
  signing_key:
115
- specification_version: 3
107
+ specification_version: 4
116
108
  summary: Spec your cells.
117
109
  test_files: []