34 lines
1.0 KiB
Ruby
34 lines
1.0 KiB
Ruby
|
require 'rails_helper'
|
||
|
|
||
|
RSpec.describe NotesController,type: :controller do
|
||
|
|
||
|
describe "GET #getNotesList" do
|
||
|
|
||
|
it "return correct json format of noteslist" do
|
||
|
|
||
|
register = create(:user)
|
||
|
user = User.find_by(email: register.email)
|
||
|
session[:user_id] = user.id
|
||
|
|
||
|
params = {name: "project mission update test",content: "update test"}
|
||
|
project = Project.new(params)
|
||
|
project.users << register
|
||
|
project.save
|
||
|
|
||
|
params_note = {content: "note content 1",user_id: user.id,category: 2,project_id: project.id}
|
||
|
note = Note.new(params_note)
|
||
|
note.save
|
||
|
|
||
|
params_note2 = {content: "note content 2",user_id: user.id,category: 1,project_id: project.id}
|
||
|
note2 = Note.new(params_note2)
|
||
|
note2.save
|
||
|
|
||
|
|
||
|
post :getNotesList,project_id: project.id
|
||
|
puts response.body
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|