Sha256: 1f4b66887d75240b0e1defcfe42f410217fcf353b734b4f2df7c8d4f859019e3

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 KB

Contents

describe 'users/_follower_modal.html.erb', type: :view do
  let(:frank) { FactoryGirl.create(:user, display_name: "Frank") }
  let(:page) { Capybara::Node::Simple.new(rendered) }

  before do
    allow(controller).to receive(:current_user) { current_user }
    render partial: 'users/follower_modal', locals: { user: view_user, followers: followers }
  end

  context 'with followers' do
    let(:view_user) {}
    let(:current_user) {}
    let(:followers) { [frank] }

    it "draws user list" do
      expect(page).to have_link "Frank", href: "/users/#{frank.to_param}"
    end
  end

  context "with no followers" do
    let(:followers) { [] }
    let(:view_user) { frank }

    context 'when logged in' do
      context 'when current user has no followers' do
        let(:current_user) { frank }
        it "indicates the lack of followers for you" do
          expect(page).to have_text "No one is following you."
        end
      end
      context 'when another user has no followers' do
        let(:current_user) { stub_model(User) }
        it "indicates the lack of followers for this user" do
          expect(page).to have_text "No one is following this user."
        end
      end
    end
    context 'when not logged in' do
      let(:current_user) {}

      it 'indicates the lack of followers for this user' do
        expect(page).to have_text 'No one is following this user.'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-7.1.0 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-7.0.0 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-7.0.0.rc2 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-7.0.0.rc1 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-7.0.0.beta4 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-7.0.0.beta3 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-7.0.0.beta2 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-7.0.0.beta1 spec/views/users/_follower_modal.html.erb_spec.rb