Add a bunch of pending specs for the lectures
This commit is contained in:
parent
90c3361f88
commit
663cd6bcde
|
@ -1,45 +1,73 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe LecturesController, :type => :controller do
|
RSpec.describe LecturesController, type: :controller do
|
||||||
|
let(:user) { create :user, confirmed_at: Time.now }
|
||||||
|
|
||||||
describe "GET new" do
|
before do
|
||||||
it "returns http success" do
|
sign_in user
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET new' do
|
||||||
|
it 'returns http success' do
|
||||||
get :new
|
get :new
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'assigns a blank lecture to @lecture'
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST create" do
|
describe 'POST create' do
|
||||||
it "returns http success" do
|
it 'assigns the new lecture to @lecture'
|
||||||
new_track = create :track
|
|
||||||
new_user = create :user
|
|
||||||
|
|
||||||
post :create, lecture: build(:lecture, track: new_track, user: new_user).attributes
|
context 'when passed correct parameters' do
|
||||||
expect(response.status).to eq 201
|
it 'creates a new lecture'
|
||||||
|
it 'redirects to the created lecture'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when passed incorrect parameters' do
|
||||||
|
it 'renders the edit template'
|
||||||
|
it 'returns HTTP Unprocessable Entity status code'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET edit" do
|
describe 'GET edit' do
|
||||||
it "returns http success" do
|
context 'when the lecture exists' do
|
||||||
event = create :lecture
|
it 'returns http success'
|
||||||
get :edit, id: event.id
|
it 'assigns the lecture to @lecture'
|
||||||
expect(response).to be_success
|
end
|
||||||
|
|
||||||
|
context 'when the lecture does not exist' do
|
||||||
|
it 'returns HTTP Not Found status code'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PUT update" do
|
describe 'PUT update' do
|
||||||
it "returns http success" do
|
context 'when the lecture does not exist' do
|
||||||
event = create :lecture
|
it 'returns HTTP Not Found status code'
|
||||||
put :update, id: event.id, lecture: event.attributes
|
end
|
||||||
expect(response).to be_success
|
|
||||||
|
context 'when the lecture exists' do
|
||||||
|
it 'assigns the lecture to @lecture'
|
||||||
|
|
||||||
|
context 'when passed correct parameters' do
|
||||||
|
it 'redirects to the updated lecture'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when passed incorrect parameters' do
|
||||||
|
it 'renders the edit template'
|
||||||
|
it 'returns HTTP Unprocessable Entity status code'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET show" do
|
describe 'GET show' do
|
||||||
it "returns http success" do
|
context 'when the lecture exists' do
|
||||||
event = create :lecture
|
it 'returns HTTP Success status code'
|
||||||
get :show, id: event.id
|
it 'assigns the lecture to @lecture'
|
||||||
expect(response).to be_success
|
end
|
||||||
|
|
||||||
|
context 'when the lecture does not exist' do
|
||||||
|
it 'returns HTTP Not Found status code'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.include Devise::TestHelpers, type: :controller
|
||||||
|
end
|
Loading…
Reference in New Issue