require 'test_helper'

# EnrolmentTest is the generic model test for enrolments
class EnrolmentTest < ActiveSupport::TestCase
  def setup
    @enrolment = enrolments(:one)
  end

  test 'should be valid' do
    assert @enrolment.valid?
  end

  test 'should have a user' do
    @enrolment.user = nil
    assert_not @enrolment.valid?
  end

  test 'should have an initiative' do
    @enrolment.initiative = nil
    assert_not @enrolment.valid?
  end
end

require 'test_helper'

# EnrolmentTest is the generic model test for enrolments
class EnrolmentTest < ActiveSupport::TestCase
  def setup
    @enrolment = enrolments(:one)
  end

  test 'should be valid' do
    assert @enrolment.valid?
  end

  test 'should have a user' do
    @enrolment.user = nil
    assert_not @enrolment.valid?
  end

  test 'should have an initiative' do
    @enrolment.initiative = nil
    assert_not @enrolment.valid?
  end

  test 'index on user and initiative' do
    @duplicate_enrolment = @enrolment.dup
    assert_not @duplicate_enrolment.valid?
    assert_no_difference 'Enrolment.count' do
      @duplicate_enrolment.save
    end
  end
end

Add test for index on user and initiative for an enrolment.
Add test for index on user and initiative for an enrolment.
