Sha256: 40d317a977aee5944358f38b69cdcd00b458aba8cd469dde175f74d8fe695520

Contents?: true

Size: 908 Bytes

Versions: 5

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe "_user_util_links" do

  let :blacklight_config do
    Blacklight::Configuration.new.configure do |config|
      config.navbar.partials = { bookmark: Blacklight::Configuration::ToolConfig.new(partial: 'blacklight/nav/bookmark', if: :render_bookmarks_control?) }
    end

  end

  it "should render the correct bookmark count" do
    count = rand(99)
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    allow(controller).to receive(:render_bookmarks_control?).and_return true
    allow(view).to receive(:has_user_authentication_provider?).and_return false
    allow(view).to receive_message_chain(:current_or_guest_user, :bookmarks, :count).and_return(count)
    render :partial => "user_util_links"
    expect(rendered).to have_selector('#bookmarks_nav span[data-role=bookmark-counter]', text: "#{count}")
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-6.2.0 spec/views/_user_util_links.html.erb_spec.rb
blacklight-6.1.0 spec/views/_user_util_links.html.erb_spec.rb
blacklight-6.0.2 spec/views/_user_util_links.html.erb_spec.rb
blacklight-6.0.1 spec/views/_user_util_links.html.erb_spec.rb
blacklight-6.0.0 spec/views/_user_util_links.html.erb_spec.rb