Sha256: ddb5dfeeb0bd914c80dff8f5158a7c7d0e006f54378ed6f65daa38b1e93a2a4f

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe BatchEditsHelper, type: :helper do
  describe "#render_check_all" do
    before do
      @document_list = ["doc1", "doc2"]
      @batch_size_on_other_page = 1
      @max_batch_size = 10
    end

    context "with my files" do
      it "shows the check all dropdown" do
        allow(helper).to receive(:params).and_return(controller: "my/files")
        allow(helper).to receive(:controller_name).and_return("batch_edits")
        expect(helper.render_check_all).to have_css("span.glyphicon-cog")
      end

      it "shows my action menu for my controller" do
        allow(helper).to receive(:params).and_return(controller: "my")
        allow(helper).to receive(:controller_name).and_return("my")
        expect(helper.render_check_all).not_to have_content("ABC")
      end
    end

    context "with my collections" do
      it "does not show the check all dropdown" do
        allow(helper).to receive(:params).and_return(controller: "my/collections")
        expect(helper.render_check_all).to be_nil
      end
    end

    context "with select all disabled" do
      it "does not show the check all dropdown" do
        allow(helper).to receive(:params).and_return(controller: "foo")
        assign(:disable_select_all, true)
        expect(helper.render_check_all).to have_css("input[disabled=disabled]")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sufia-6.7.0 spec/helpers/batch_edits_helper_spec.rb
sufia-6.6.1 spec/helpers/batch_edits_helper_spec.rb
sufia-6.6.0 spec/helpers/batch_edits_helper_spec.rb
sufia-6.5.0 spec/helpers/batch_edits_helper_spec.rb
sufia-6.4.0 spec/helpers/batch_edits_helper_spec.rb
sufia-6.3.0 spec/helpers/batch_edits_helper_spec.rb