# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'artist_artist_roles/new', type: :view do
  before do
    assign(:artist_artist_role, ArtistArtistRole.new(
                                  artist:           nil,
                                  owning_artist:    nil,
                                  role:             nil,
                                  begin_date_year:  '',
                                  begin_date_month: '',
                                  begin_date_day:   '',
                                  end_date_year:    '',
                                  end_date_month:   '',
                                  end_date_day:     ''
                                ))
  end

  it 'renders new artist_artist_role form' do
    render

    assert_select 'form[action=?][method=?]', artist_artist_roles_path, 'post' do
      assert_select 'input[name=?]', 'artist_artist_role[artist_id]'

      assert_select 'input[name=?]', 'artist_artist_role[owning_artist_id]'

      assert_select 'input[name=?]', 'artist_artist_role[role_id]'

      assert_select 'input[name=?]', 'artist_artist_role[begin_date_year]'

      assert_select 'input[name=?]', 'artist_artist_role[begin_date_month]'

      assert_select 'input[name=?]', 'artist_artist_role[begin_date_day]'

      assert_select 'input[name=?]', 'artist_artist_role[end_date_year]'

      assert_select 'input[name=?]', 'artist_artist_role[end_date_month]'

      assert_select 'input[name=?]', 'artist_artist_role[end_date_day]'
    end
  end
end
