Sha256: 5cfe0178f90d3f87f218d7de8099cbdae5755da882f017ea8afa6cf3a1e06f51

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

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
    assign :user, view_user
    allow(controller).to receive(:current_user).and_return(current_user)
    assign :followers, followers
    render
  end

  context "when 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 "when 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

6 entries across 6 versions & 1 rubygems

Version Path
sufia-6.7.0 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-6.6.1 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-6.6.0 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-6.5.0 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-6.4.0 spec/views/users/_follower_modal.html.erb_spec.rb
sufia-6.3.0 spec/views/users/_follower_modal.html.erb_spec.rb