rspec-cells 0.1.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.gitignore +1 -1
 - data/.travis.yml +7 -0
 - data/Appraisals +8 -0
 - data/CHANGES.textile +4 -0
 - data/Gemfile +2 -1
 - data/README.rdoc +11 -11
 - data/gemfiles/rspec2.gemfile +9 -0
 - data/gemfiles/rspec3.gemfile +9 -0
 - data/lib/generators/rspec/templates/cell_spec.erb +7 -7
 - data/lib/rspec/cells/cell_example_group.rb +10 -10
 - data/lib/rspec/cells/version.rb +1 -1
 - data/lib/rspec-cells.rb +1 -0
 - data/rspec-cells.gemspec +1 -1
 - data/spec/cells/cell_generator_spec.rb +24 -24
 - data/spec/cells/cell_spec_spec.rb +9 -9
 - data/spec/spec_helper.rb +3 -1
 - metadata +7 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b00052a706101e635fbfd70d6d3b38feef321326
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 22ae5044d29a41ca4107dc3be88e888b21177c35
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3d8d79e4ffc7bac6710ae8f2ed3c50a9b721726e44129001aed422f791a7b3394c8ce45e26509d78627629f216c4680934ae5fbf45cbc42feeba750696831b0d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5443a773b0ac3191fd81bed77f5d11507f192eacdd14e114241ccf7e48bcf46d6dc62f69676f19f63b445ea723bd8175d9571d185d534cde2c857669076ca705
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Appraisals
    ADDED
    
    
    
        data/CHANGES.textile
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.rdoc
    CHANGED
    
    | 
         @@ -12,7 +12,7 @@ Cells is Rails' popular {view components framework}[http://github.com/apotonick/ 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            This gem runs with RSpec2 and Rails >= 3.x, so just add it to your app's +Gemfile+.
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              group :test do
         
     | 
| 
      
 15 
     | 
    
         
            +
              group :development, :test do
         
     | 
| 
       16 
16 
     | 
    
         
             
                gem "rspec-cells"
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
         @@ -32,7 +32,7 @@ will create an exemplary <tt>spec/cells/blog_post_cell_spec.rb</tt> for you. 
     | 
|
| 
       32 
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.
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              it "renders posts count" do
         
     | 
| 
       35 
     | 
    
         
            -
                render_cell(:posts, :count). 
     | 
| 
      
 35 
     | 
    
         
            +
                expect(render_cell(:posts, :count)).to have_selector("p", :content => "4 posts!")
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            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.
         
     | 
| 
         @@ -41,7 +41,7 @@ You can create a cell instance using the +cell+ method, and then render afterwar 
     | 
|
| 
       41 
41 
     | 
    
         
             
                posts = cell(:posts)
         
     | 
| 
       42 
42 
     | 
    
         
             
                posts.stub(:recent_posts).and_return([])
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                posts.render_state(:count). 
     | 
| 
      
 44 
     | 
    
         
            +
                expect(posts.render_state(:count)).to have_selector("p", :content => "No posts!")
         
     | 
| 
       45 
45 
     | 
    
         
             
              end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
            After preparing the instance you can use +render_state+ for triggering the state.
         
     | 
| 
         @@ -52,7 +52,7 @@ After preparing the instance you can use +render_state+ for triggering the state 
     | 
|
| 
       52 
52 
     | 
    
         
             
            With the introduction of cells [view models](https://github.com/apotonick/cells#view-models) you get a slightly different API for your specs (which is identical to your app's one).
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
              it "renders empty posts list" do
         
     | 
| 
       55 
     | 
    
         
            -
                 
     | 
| 
      
 55 
     | 
    
         
            +
                expect(cell(:posts).count.to be_zero
         
     | 
| 
       56 
56 
     | 
    
         
             
              end
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
58 
     | 
    
         
             
            It's pretty simple, you use `#cell` to instantiate a view model instance and then call the state method on it.
         
     | 
| 
         @@ -76,22 +76,22 @@ You can then use capybara's matchers in your cell spec. 
     | 
|
| 
       76 
76 
     | 
    
         
             
                  let(:search) { render_cell(:posts, :search) }
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
78 
     | 
    
         
             
                  it "should have a search field" do
         
     | 
| 
       79 
     | 
    
         
            -
                    search. 
     | 
| 
      
 79 
     | 
    
         
            +
                    expect(search).to have_field("Search by Title")
         
     | 
| 
       80 
80 
     | 
    
         
             
                  end
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
82 
     | 
    
         
             
                  it "should have a search button" do
         
     | 
| 
       83 
     | 
    
         
            -
                    search. 
     | 
| 
      
 83 
     | 
    
         
            +
                    expect(search).to have_button("Search")
         
     | 
| 
       84 
84 
     | 
    
         
             
                  end
         
     | 
| 
       85 
85 
     | 
    
         
             
                end
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
87 
     | 
    
         
             
                describe "latest posts" do
         
     | 
| 
       88 
88 
     | 
    
         
             
                  subject { render_cell(:posts, :latest) }
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                  it {  
     | 
| 
       91 
     | 
    
         
            -
                  it {  
     | 
| 
       92 
     | 
    
         
            -
                  it {  
     | 
| 
       93 
     | 
    
         
            -
                  it {  
     | 
| 
       94 
     | 
    
         
            -
                  it {  
     | 
| 
      
 90 
     | 
    
         
            +
                  it { is_expected.to have_css("h3.title", :text => "Latest Posts") }
         
     | 
| 
      
 91 
     | 
    
         
            +
                  it { is_expected.to have_table("latest_posts") }
         
     | 
| 
      
 92 
     | 
    
         
            +
                  it { is_expected.to have_link("View all Posts") }
         
     | 
| 
      
 93 
     | 
    
         
            +
                  it { is_expected.to_not have_button("Create Post") }
         
     | 
| 
      
 94 
     | 
    
         
            +
                  it { is_expected.to_not have_field("Search by Title") }
         
     | 
| 
       95 
95 
     | 
    
         
             
                end
         
     | 
| 
       96 
96 
     | 
    
         
             
              end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
         @@ -1,18 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe <%= class_name %>Cell do
         
     | 
| 
      
 3 
     | 
    
         
            +
            describe <%= class_name %>Cell, type: :cell do
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
              context  
     | 
| 
      
 5 
     | 
    
         
            +
              context 'cell rendering' do
         
     | 
| 
       6 
6 
     | 
    
         
             
              <%- actions.each_with_index do |state, index| -%>
         
     | 
| 
       7 
     | 
    
         
            -
                context  
     | 
| 
      
 7 
     | 
    
         
            +
                context 'rendering <%= state %>' do
         
     | 
| 
       8 
8 
     | 
    
         
             
                  subject { render_cell(<%= cell_name %>, :<%= state %>) }
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                  <%- if defined?(Capybara) -%>
         
     | 
| 
       11 
     | 
    
         
            -
                  it {  
     | 
| 
       12 
     | 
    
         
            -
                  it {  
     | 
| 
      
 11 
     | 
    
         
            +
                  it { is_expected.to have_selector('h1', text: '<%= class_name %>#<%= state %>') }
         
     | 
| 
      
 12 
     | 
    
         
            +
                  it { is_expected.to have_selector('p', text: 'Find me in app/cells/<%= file_path %>/<%= state %>.html') }
         
     | 
| 
       13 
13 
     | 
    
         
             
                  <%- else -%>
         
     | 
| 
       14 
     | 
    
         
            -
                  it {  
     | 
| 
       15 
     | 
    
         
            -
                  it {  
     | 
| 
      
 14 
     | 
    
         
            +
                  it { is_expected.to include '<%= class_name %>#<%= state %>' }
         
     | 
| 
      
 15 
     | 
    
         
            +
                  it { is_expected.to include 'Find me in app/cells/<%= file_path %>/<%= state %>.html' }
         
     | 
| 
       16 
16 
     | 
    
         
             
                  <%- end -%>
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
                <%- unless index == actions.length - 1 -%>
         
     | 
| 
         @@ -7,16 +7,15 @@ module RSpec::Rails 
     | 
|
| 
       7 
7 
     | 
    
         
             
                include Cell::TestCase::TestMethods
         
     | 
| 
       8 
8 
     | 
    
         
             
                include ActionController::UrlFor
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                if defined?(Webrat)
         
     | 
| 
       11 
     | 
    
         
            -
                  include Webrat::Matchers
         
     | 
| 
       12 
     | 
    
         
            -
                  include Webrat::Methods
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
                if defined?(::Webrat)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  include ::Webrat::Matchers
         
     | 
| 
      
 12 
     | 
    
         
            +
                  include ::Webrat::Methods
         
     | 
| 
       14 
13 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
                elsif defined?(::Capybara)
         
     | 
| 
       16 
15 
     | 
    
         
             
                  begin
         
     | 
| 
       17 
     | 
    
         
            -
                    include Capybara::DSL
         
     | 
| 
      
 16 
     | 
    
         
            +
                    include ::Capybara::DSL
         
     | 
| 
       18 
17 
     | 
    
         
             
                  rescue NameError
         
     | 
| 
       19 
     | 
    
         
            -
                    include Capybara
         
     | 
| 
      
 18 
     | 
    
         
            +
                    include ::Capybara
         
     | 
| 
       20 
19 
     | 
    
         
             
                  end
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
       22 
21 
     | 
    
         
             
                  # Overwrite to wrap render_cell into a Capybara custom string with a
         
     | 
| 
         @@ -33,11 +32,11 @@ module RSpec::Rails 
     | 
|
| 
       33 
32 
     | 
    
         
             
                  # That expose all the methods from the following capybara modules:
         
     | 
| 
       34 
33 
     | 
    
         
             
                  #   - http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers
         
     | 
| 
       35 
34 
     | 
    
         
             
                  #   - http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Finders
         
     | 
| 
       36 
     | 
    
         
            -
                  def render_cell(* 
     | 
| 
      
 35 
     | 
    
         
            +
                  def render_cell(*)
         
     | 
| 
       37 
36 
     | 
    
         
             
                    Capybara.string super
         
     | 
| 
       38 
37 
     | 
    
         
             
                  end
         
     | 
| 
       39 
38 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                  def cell(* 
     | 
| 
      
 39 
     | 
    
         
            +
                  def cell(*)
         
     | 
| 
       41 
40 
     | 
    
         
             
                    Content.new(super)
         
     | 
| 
       42 
41 
     | 
    
         
             
                  end
         
     | 
| 
       43 
42 
     | 
    
         | 
| 
         @@ -84,5 +83,6 @@ module RSpec::Rails 
     | 
|
| 
       84 
83 
     | 
    
         
             
            end
         
     | 
| 
       85 
84 
     | 
    
         | 
| 
       86 
85 
     | 
    
         
             
            RSpec.configure do |c|
         
     | 
| 
       87 
     | 
    
         
            -
              c.include RSpec::Rails::CellExampleGroup, : 
     | 
| 
      
 86 
     | 
    
         
            +
              c.include RSpec::Rails::CellExampleGroup, :file_path => /spec\/cells/
         
     | 
| 
      
 87 
     | 
    
         
            +
              c.include RSpec::Rails::CellExampleGroup, :type => :cell
         
     | 
| 
       88 
88 
     | 
    
         
             
            end
         
     | 
    
        data/lib/rspec/cells/version.rb
    CHANGED
    
    
    
        data/lib/rspec-cells.rb
    CHANGED
    
    
    
        data/rspec-cells.gemspec
    CHANGED
    
    | 
         @@ -20,6 +20,6 @@ Gem::Specification.new do |s| 
     | 
|
| 
       20 
20 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
              s.add_runtime_dependency "railties",    ">= 3.0"
         
     | 
| 
       23 
     | 
    
         
            -
              s.add_runtime_dependency  
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_runtime_dependency 'rspec-rails', '>= 2.99'
         
     | 
| 
       24 
24 
     | 
    
         
             
              s.add_runtime_dependency "cells",       ">= 3.4.0"
         
     | 
| 
       25 
25 
     | 
    
         
             
            end
         
     | 
| 
         @@ -32,24 +32,24 @@ describe Rspec::Generators::CellGenerator do 
     | 
|
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                it "creates widget spec" do
         
     | 
| 
       34 
34 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t("require 'spec_helper'")
         
     | 
| 
       35 
     | 
    
         
            -
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('describe TwitterCell do')
         
     | 
| 
       36 
     | 
    
         
            -
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('context  
     | 
| 
      
 35 
     | 
    
         
            +
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('describe TwitterCell, type: :cell do')
         
     | 
| 
      
 36 
     | 
    
         
            +
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('context \'cell rendering\' do')
         
     | 
| 
       37 
37 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
         
     | 
| 
       38 
38 
     | 
    
         
             
                end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                it 'creates display state' do
         
     | 
| 
       41 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 41 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('context \'rendering display\' do')
         
     | 
| 
       42 
42 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('subject { render_cell(:twitter, :display) }')
         
     | 
| 
       43 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
       44 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 43 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('it { is_expected.to have_selector(\'h1\', text: \'Twitter#display\') }')
         
     | 
| 
      
 44 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('it { is_expected.to have_selector(\'p\', text: \'Find me in app/cells/twitter/display.html\') }')
         
     | 
| 
       45 
45 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
         
     | 
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                it 'creates form state' do
         
     | 
| 
       49 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 49 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('context \'rendering form\' do')
         
     | 
| 
       50 
50 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('subject { render_cell(:twitter, :form) }')
         
     | 
| 
       51 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
       52 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 51 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('it { is_expected.to have_selector(\'h1\', text: \'Twitter#form\') }')
         
     | 
| 
      
 52 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('it { is_expected.to have_selector(\'p\', text: \'Find me in app/cells/twitter/form.html\') }')
         
     | 
| 
       53 
53 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
         
     | 
| 
       54 
54 
     | 
    
         
             
                end
         
     | 
| 
       55 
55 
     | 
    
         
             
              end
         
     | 
| 
         @@ -65,24 +65,24 @@ describe Rspec::Generators::CellGenerator do 
     | 
|
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
                it "creates widget spec" do
         
     | 
| 
       67 
67 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t("require 'spec_helper'")
         
     | 
| 
       68 
     | 
    
         
            -
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('describe TwitterCell do')
         
     | 
| 
       69 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 68 
     | 
    
         
            +
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('describe TwitterCell, type: :cell do')
         
     | 
| 
      
 69 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('context \'cell rendering\' do')
         
     | 
| 
       70 
70 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
         
     | 
| 
       71 
71 
     | 
    
         
             
                end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
                it 'creates display state' do
         
     | 
| 
       74 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 74 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('context \'rendering display\' do')
         
     | 
| 
       75 
75 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('subject { render_cell(:twitter, :display) }')
         
     | 
| 
       76 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
       77 
     | 
    
         
            -
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('it {  
     | 
| 
      
 76 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('it { is_expected.to include \'Twitter#display\' }')
         
     | 
| 
      
 77 
     | 
    
         
            +
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('it { is_expected.to include \'Find me in app/cells/twitter/display.html\' }')
         
     | 
| 
       78 
78 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
         
     | 
| 
       79 
79 
     | 
    
         
             
                end
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
       81 
81 
     | 
    
         
             
                it 'creates form state' do
         
     | 
| 
       82 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 82 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('context \'rendering form\' do')
         
     | 
| 
       83 
83 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('subject { render_cell(:twitter, :form) }')
         
     | 
| 
       84 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
       85 
     | 
    
         
            -
                  test.assert_file  
     | 
| 
      
 84 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('it { is_expected.to include \'Twitter#form\' }')
         
     | 
| 
      
 85 
     | 
    
         
            +
                  test.assert_file 'spec/cells/twitter_cell_spec.rb', t('it { is_expected.to include \'Find me in app/cells/twitter/form.html\' }')
         
     | 
| 
       86 
86 
     | 
    
         
             
                  test.assert_file "spec/cells/twitter_cell_spec.rb", t('end')
         
     | 
| 
       87 
87 
     | 
    
         
             
                end
         
     | 
| 
       88 
88 
     | 
    
         
             
              end
         
     | 
| 
         @@ -101,24 +101,24 @@ describe Rspec::Generators::CellGenerator do 
     | 
|
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
                it "creates widget spec" do
         
     | 
| 
       103 
103 
     | 
    
         
             
                  test.assert_file GENERATED_FILE, t("require 'spec_helper'")
         
     | 
| 
       104 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('describe Forum::CommentCell do')
         
     | 
| 
       105 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('context  
     | 
| 
      
 104 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('describe Forum::CommentCell, type: :cell do')
         
     | 
| 
      
 105 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('context \'cell rendering\' do')
         
     | 
| 
       106 
106 
     | 
    
         
             
                  test.assert_file GENERATED_FILE, t('end')
         
     | 
| 
       107 
107 
     | 
    
         
             
                end
         
     | 
| 
       108 
108 
     | 
    
         | 
| 
       109 
109 
     | 
    
         
             
                it 'creates display state' do
         
     | 
| 
       110 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('context  
     | 
| 
      
 110 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('context \'rendering display\' do')
         
     | 
| 
       111 
111 
     | 
    
         
             
                  test.assert_file GENERATED_FILE, t('subject { render_cell("forum/comment", :display) }')
         
     | 
| 
       112 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('it {  
     | 
| 
       113 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('it {  
     | 
| 
      
 112 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('it { is_expected.to include \'Forum::Comment#display\' }')
         
     | 
| 
      
 113 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('it { is_expected.to include \'Find me in app/cells/forum/comment/display.html\' }')
         
     | 
| 
       114 
114 
     | 
    
         
             
                  test.assert_file GENERATED_FILE, t('end')
         
     | 
| 
       115 
115 
     | 
    
         
             
                end
         
     | 
| 
       116 
116 
     | 
    
         | 
| 
       117 
117 
     | 
    
         
             
                it 'creates form state' do
         
     | 
| 
       118 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('context  
     | 
| 
      
 118 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('context \'rendering form\' do')
         
     | 
| 
       119 
119 
     | 
    
         
             
                  test.assert_file GENERATED_FILE, t('subject { render_cell("forum/comment", :form) }')
         
     | 
| 
       120 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('it {  
     | 
| 
       121 
     | 
    
         
            -
                  test.assert_file GENERATED_FILE, t('it {  
     | 
| 
      
 120 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('it { is_expected.to include \'Forum::Comment#form\' }')
         
     | 
| 
      
 121 
     | 
    
         
            +
                  test.assert_file GENERATED_FILE, t('it { is_expected.to include \'Find me in app/cells/forum/comment/form.html\' }')
         
     | 
| 
       122 
122 
     | 
    
         
             
                  test.assert_file GENERATED_FILE, t('end')
         
     | 
| 
       123 
123 
     | 
    
         
             
                end
         
     | 
| 
       124 
124 
     | 
    
         
             
              end
         
     | 
| 
         @@ -22,26 +22,26 @@ module RSpec::Rails 
     | 
|
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                it "adds :type => :cell to the metadata" do
         
     | 
| 
       25 
     | 
    
         
            -
                  group.metadata[:type]. 
     | 
| 
      
 25 
     | 
    
         
            +
                  expect(group.metadata[:type]).to eq(:cell)
         
     | 
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                describe "#render_cell" do
         
     | 
| 
       29 
29 
     | 
    
         
             
                  it "renders a state" do
         
     | 
| 
       30 
     | 
    
         
            -
                    group.new.render_cell(:dummy, :show). 
     | 
| 
      
 30 
     | 
    
         
            +
                    expect(group.new.render_cell(:dummy, :show)).to eq("<p>I'm Dummy.</p>")
         
     | 
| 
       31 
31 
     | 
    
         
             
                  end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                  it "allows passing state args" do
         
     | 
| 
       34 
     | 
    
         
            -
                    group.new.render_cell(:dummy, :update, "this"). 
     | 
| 
      
 34 
     | 
    
         
            +
                    expect(group.new.render_cell(:dummy, :update, "this")).to eq('Updating this.')
         
     | 
| 
       35 
35 
     | 
    
         
             
                  end
         
     | 
| 
       36 
36 
     | 
    
         
             
                end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                it "responds to #cell" do
         
     | 
| 
       39 
     | 
    
         
            -
                  group.new.cell(:dummy). 
     | 
| 
      
 39 
     | 
    
         
            +
                  expect(group.new.cell(:dummy)).to be_kind_of(DummyCell)
         
     | 
| 
       40 
40 
     | 
    
         
             
                end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                # FIXME: could anyone make capybara/rails work in these tests?
         
     | 
| 
       43 
43 
     | 
    
         
             
                # it "allows using matchers with #render_state" do
         
     | 
| 
       44 
     | 
    
         
            -
                #   cell(:dummy).render_state(:show). 
     | 
| 
      
 44 
     | 
    
         
            +
                #   expect(cell(:dummy).render_state(:show)).to have_selector("p")
         
     | 
| 
       45 
45 
     | 
    
         
             
                # end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                context "as a test writer" do
         
     | 
| 
         @@ -49,15 +49,15 @@ module RSpec::Rails 
     | 
|
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
                  it "should support _path helpers from the controller" do
         
     | 
| 
       51 
51 
     | 
    
         
             
                    # We have to stub include so that things determine the route exists.
         
     | 
| 
       52 
     | 
    
         
            -
                    Rails.application.routes.named_routes.helpers. 
     | 
| 
       53 
     | 
    
         
            -
                    @controller. 
     | 
| 
      
 52 
     | 
    
         
            +
                    allow(Rails.application.routes.named_routes.helpers).to receive(:include?).and_return(true)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    expect(@controller).to receive(:test_path).at_least(:once)
         
     | 
| 
       54 
54 
     | 
    
         
             
                    test_path
         
     | 
| 
       55 
55 
     | 
    
         
             
                  end
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
                  it "should support polymorphic_path from the controller" do
         
     | 
| 
       58 
58 
     | 
    
         
             
                    # We have to stub include so that things determine the route exists.
         
     | 
| 
       59 
     | 
    
         
            -
                    Rails.application.routes.named_routes.helpers. 
     | 
| 
       60 
     | 
    
         
            -
                    @controller. 
     | 
| 
      
 59 
     | 
    
         
            +
                    allow(Rails.application.routes.named_routes.helpers).to receive(:include?).and_return(true)
         
     | 
| 
      
 60 
     | 
    
         
            +
                    expect(@controller).to receive(:test_path).at_least(:once)
         
     | 
| 
       61 
61 
     | 
    
         
             
                    polymorphic_path(:test)
         
     | 
| 
       62 
62 
     | 
    
         
             
                  end
         
     | 
| 
       63 
63 
     | 
    
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -2,7 +2,9 @@ require 'rubygems' unless defined?(Gem) 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'bundler/setup'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            #$:.unshift File.dirname(__FILE__) # add current dir to LOAD_PATHS
         
     | 
| 
       5 
     | 
    
         
            -
            require  
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rails'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'action_controller/railtie'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'action_view/railtie'
         
     | 
| 
       6 
8 
     | 
    
         
             
            require 'rspec-cells'
         
     | 
| 
       7 
9 
     | 
    
         
             
            require 'rspec/rails'
         
     | 
| 
       8 
10 
     | 
    
         
             
            require 'cell/base'
         
     | 
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       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-06-11 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: railties
         
     | 
| 
         @@ -30,14 +30,14 @@ dependencies: 
     | 
|
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - ">="
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: 2. 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '2.99'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
38 
     | 
    
         
             
                - - ">="
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: 2. 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '2.99'
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: cells
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -61,11 +61,14 @@ extra_rdoc_files: [] 
     | 
|
| 
       61 
61 
     | 
    
         
             
            files:
         
     | 
| 
       62 
62 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       63 
63 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
      
 64 
     | 
    
         
            +
            - Appraisals
         
     | 
| 
       64 
65 
     | 
    
         
             
            - CHANGES.textile
         
     | 
| 
       65 
66 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       66 
67 
     | 
    
         
             
            - MIT-LICENSE
         
     | 
| 
       67 
68 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       68 
69 
     | 
    
         
             
            - Rakefile
         
     | 
| 
      
 70 
     | 
    
         
            +
            - gemfiles/rspec2.gemfile
         
     | 
| 
      
 71 
     | 
    
         
            +
            - gemfiles/rspec3.gemfile
         
     | 
| 
       69 
72 
     | 
    
         
             
            - lib/generators/rspec/cell_generator.rb
         
     | 
| 
       70 
73 
     | 
    
         
             
            - lib/generators/rspec/templates/cell_spec.erb
         
     | 
| 
       71 
74 
     | 
    
         
             
            - lib/rspec-cells.rb
         
     |