trailblazer / rspec-cells

Spec your Cells.
http://cells.rubyforge.org
MIT License
62 stars 48 forks source link

[WIP] version 0.3.0 #55

Closed seuros closed 9 years ago

seuros commented 10 years ago

@apotonick @pikachuexe

Can you try this branch in your existing apps.

apotonick commented 10 years ago

Coolio! Will try it tomorrow (feel free to make it 1.0).

PikachuEXE commented 10 years ago

I am still at 0.1.12 Got many error when upgrading to 0.2.x No time to find out why Q_Q

apotonick commented 10 years ago

What kind of errors, @PikachuEXE ?

PikachuEXE commented 10 years ago

Leaving office now. I will tell you tomorrow

PikachuEXE commented 10 years ago

Not sure what's happened, now the error is gone (I don't quite remember what's wrong when I was upgrading to 0.2.*) Let me try this PR now

PikachuEXE commented 10 years ago

I got:

undefined method `polymorphic_path'
undefined method `render_cell'

in all cell spec

seuros commented 10 years ago

can you paste the spec ?

PikachuEXE commented 10 years ago

Lazy and busy, so I just paste here:

require 'spec_helper'

describe UserMenuCell do

  describe "cell rendering" do
    describe "#show" do
      context 'when is_mobile is true' do
        subject { render_cell(:user_menu, :show, current_user: current_user, is_mobile: false) }

        context 'when user is not logged in' do
          let(:current_user) { nil }

          it { should have_link(I18n.t('cells.user_menu.sign_up', href: new_user_registration_path)) }
          it { should have_link(I18n.t('cells.user_menu.sign_in', href: new_user_session_path)) }

          it_behaves_like 'cell with caching'
        end

        context 'when user is logged in' do
          let(:current_user) { create(:user) }

          describe 'dropdown menu' do
            it {should have_selector('.dropdown .dropdown-toggle')}
            it {should have_selector('.dropdown .dropdown-menu')}
          end

          it {should have_link(I18n.t('cells.user_menu.settings', href: my_settings_path))}
          it {should have_link(I18n.t('cells.user_menu.sign_out', href: destroy_user_session_path))}

          it_behaves_like 'cell with caching'
        end
      end
      context 'when is_mobile is false' do
        subject { render_cell(:user_menu, :show, current_user: current_user, is_mobile: true) }

        context 'when user is not logged in' do
          let(:current_user) { nil }

          it { should have_link(I18n.t('cells.user_menu.sign_up', href: new_user_registration_path)) }
          it { should have_link(I18n.t('cells.user_menu.sign_in', href: new_user_session_path)) }

          it_behaves_like 'cell with caching'
        end

        context 'when user is logged in' do
          let(:current_user) { create(:user) }

          it {should have_link(I18n.t('cells.user_menu.settings', href: my_settings_path))}
          it {should have_link(I18n.t('cells.user_menu.sign_out', href: destroy_user_session_path))}

          it_behaves_like 'cell with caching'
        end
      end
    end
  end

end

with errors like

undefined local variable or method `new_user_registration_path' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_2::Nested_1:0x0000010b655430>
undefined method `render_cell' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_2::Nested_2::Nested_1::Nested_1:0x0000010f01a288>
seuros commented 10 years ago

Don't be lazy, you will evolve.

you need to have describe UserMenuCell, type: :cell do

PikachuEXE commented 10 years ago

OK even I have put describe UserMenuCell, type: :cell do I still got the same errors

I don't think that's the problem since I have config.infer_spec_type_from_file_location! and that works in 0.2.*

I will work hard to NOT evolve :D

seuros commented 10 years ago

@apotonick Any update ? Did you had a chance to test this PR ?

apotonick commented 10 years ago

I'll give it a go tomorrow! Thanks!

PikachuEXE commented 10 years ago

No movement ._.?

apotonick commented 10 years ago

Absolutely, we decided to wait until Cells 4.0 is released, then update rspec-cells, which should be pretty easy, then.

PikachuEXE commented 10 years ago

Sure :>