require 'rails_helper'
require 'controller_actions_helper'

controllers_with_actions.each do |controller|
  next unless controller[:class].respond_to?(:plain_html?)

  describe controller[:class] do
    controller[:actions].each do |action|
      context "GET #{action}" do
        it 'requires authentication' do
          get action
          expect(response.status).to eq(302)
        end

        it 'returns 200 for a normal user' do
          establish_current_user(create(:user))
          get action
          expect(response.status).to eq(200)
        end
      end
    end
  end
end
