Sha256: df8c48409cd8dc0206eb609b8c384f82d6e193f9593392a995e154894a87b799

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe 'batch/edit.html.erb' do
  let(:batch) { Batch.create }
  let(:generic_file) do
    GenericFile.new(title: ['some title']).tap do |f|
      f.apply_depositor_metadata("bob")
    end
  end
  let(:form) { Sufia::Forms::BatchEditForm.new(generic_file) }

  before do
    allow(controller).to receive(:current_user).and_return(stub_model(User))
    assign :batch, batch
    assign :form, form
    render
  end

  it "draws the page" do
    # form
    expect(rendered).to have_selector "form#new_generic_file"
    # should have browser validations
    expect(rendered).not_to have_selector "form#new_generic_file[novalidate]"

    # tooltip for visibility
    expect(rendered).to have_selector "span#visibility_tooltip a i.help-icon"

    # tooltip for share_with
    expect(rendered).to have_selector "span#share_with_tooltip a i.help-icon"

    # access rights
    expect(rendered).to have_selector("div#rightsModal .modal-dialog .modal-content")
    expect(rendered).to have_selector('select#generic_file_rights[name="generic_file[rights][]"]')
    page = Capybara::Node::Simple.new(rendered)
    page.all('select#generic_file_rights option').each do |elem|
      expect(elem.value).to_not be_empty
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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