Sha256: 879ef029c33ee0fed5db5e8475a885803fb45f61a4bb56c624b9a1db2660cd95

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe 'sufia/batch_uploads/_form.html.erb' do
  let(:work) { GenericWork.new }
  let(:ability) { double('ability', current_user: user) }
  let(:form) { Sufia::Forms::BatchUploadForm.new(work, ability) }
  let(:user) { stub_model(User) }

  before do
    view.lookup_context.view_paths.push "#{CurationConcerns::Engine.root}/app/views/curation_concerns/base"
    view.lookup_context.view_paths.push 'app/views/sufia/batch_uploads'
    view.lookup_context.view_paths.push 'app/views/curation_concerns/base'
    allow(view).to receive(:curation_concern).and_return(work)
    allow(controller).to receive(:current_user).and_return(user)
    assign(:form, form)
    controller.stub(:controller_name).and_return('batch_uploads')
    controller.stub(:action_name).and_return('new')
  end

  let(:page) do
    render
    Capybara::Node::Simple.new(rendered)
  end

  it "draws the page" do
    expect(page).to have_selector("form[action='/batch_uploads']")
    # No title, because it's captured per file (e.g. Display label)
    expect(page).not_to have_selector("input#generic_work_title")
    expect(page).to have_link("New Work", href: "/concern/generic_works/new")
    expect(page).to have_link("Cancel", href: "/dashboard")
    expect(rendered).to match(/Display label/)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sufia-7.0.0.beta3 spec/views/sufia/batch_uploads/_form.html.erb_spec.rb