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