adding more authentication, fixing category bug

This commit is contained in:
Jared Cosulich 2017-04-13 11:29:56 -04:00
parent 60a2982724
commit 42fd3edbae
10 changed files with 28 additions and 93 deletions

View file

@ -23,6 +23,7 @@ RSpec.describe QuestionsController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# Question. As you add validations to Question, be sure to
# adjust the attributes here as well.
let!(:user) { User.create(email: 'test@test.com', password: '123456') }
let (:category) { Category.create!(name: 'Category') }
let(:valid_attributes) {
{
@ -45,6 +46,10 @@ RSpec.describe QuestionsController, type: :controller do
# QuestionsController. Be sure to keep this updated too.
let(:valid_session) { {} }
before :each do
sign_in user
end
describe "GET #index" do
it "assigns all questions as @questions" do
question = Question.create! valid_attributes

View file

@ -20,6 +20,7 @@ require 'rails_helper'
RSpec.describe SchedulesController, type: :controller do
let!(:user) { User.create(email: 'test@test.com', password: '123456') }
let!(:school) { School.create!(name: 'School') }
let!(:recipients) { create_recipients(school, 3) }
@ -54,12 +55,9 @@ RSpec.describe SchedulesController, type: :controller do
# SchedulesController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "assigns all schedules as @schedules" do
schedule = Schedule.create! valid_attributes
get :index, params: {school_id: school.id}, session: valid_session
expect(assigns(:schedules)).to eq([schedule])
end
before :each do
user.user_schools.create(school: school)
sign_in user
end
describe "GET #show" do