<commit_before>require 'rails_helper'

RSpec.describe Admin::RideYearsController, :type => :controller do

	let(:admin) { FactoryGirl.create(:admin) }
	let(:old_ride_year){ FactoryGirl.create(:ride_year, :old)}
	let(:new_ry_attr ){ FactoryGirl.attributes_for(:ride_year, :current)}
	# login_admin(FactoryGirl.create(:admin))
	
	context 'authenticates admin before action' do
		it 'redirects non logged in user to admin sign in page' do 
			get :index
			expect(response).to redirect_to(new_admin_session_path)
		end

		it 'allows logged in admin to access actions' do 
			sign_in admin
			get :index
			expect(response).to render_template(:index)
		end
	end

	context 'index' do 
		it 'renders created ride years' do 
			sign_in admin
			get :index
			expect(assigns(:ride_years)).to eq([old_ride_year])
			expect(response).to render_template(:index)
		end
	end
	

	# it 'allows logged in admin to get new admin template' do
	# 	# Devise::TestHelper method
	# 	sign_in admin
	# 	get :new
	# 	expect(response).to render_template(:new)
	# end

	# it 'allows admin to create new admin with valid params' do <commit_msg>admin/ride_years cont #new test passes<commit_after>require 'rails_helper'

RSpec.describe Admin::RideYearsController, :type => :controller do

	let(:admin) { FactoryGirl.create(:admin) }
	let(:old_ride_year){ FactoryGirl.create(:ride_year, :old)}
	let(:new_ry_attr ){ FactoryGirl.attributes_for(:ride_year, :current)}
	# login_admin(FactoryGirl.create(:admin))
	
	context 'authenticates admin before action' do
		it 'redirects non logged in user to admin sign in page' do 
			get :index
			expect(response).to redirect_to(new_admin_session_path)
		end

		it 'allows logged in admin to access actions' do 
			sign_in admin
			get :index
			expect(response).to render_template(:index)
		end
	end

	context 'index' do 
		it 'renders created ride years' do 
			sign_in admin
			get :index
			expect(assigns(:ride_years)).to eq([old_ride_year])
			expect(response).to render_template(:index)
		end
	end

	context 'new' do 
		it 'prepares new template for logged in admin, references current year' do 
			old_ride_year
			sign_in admin
			get :new
			expect(response).to render_template(:new)
			expect(assigns(:current)).to eq(old_ride_year)
		end
	end

	context 'create' do 
		

	end
	

	# it 'allows logged in admin to get new admin template' do
	# 	# Devise::TestHelper method
	# 	sign_in admin
	# 	get :new
	# 	expect(response).to render_template(:new)
	# end

	# it 'allows admin to create new admin with valid params' do 
{'fraction_non_alphanumeric': 0.09767625049231982, 'fraction_numerical': 0.0, 'mean_word_length': 4.38135593220339, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4550315', 'n_tokens_mistral': 932, 'n_tokens_neox': 823, 'n_words': 246}