分享功能完成;分享接口修改
This commit is contained in:
commit
bd58f7795c
|
@ -14,7 +14,7 @@ class MissionsController < ApplicationController
|
||||||
|
|
||||||
missions.each do |mission|
|
missions.each do |mission|
|
||||||
|
|
||||||
puts mission.inspect
|
#puts mission.inspect
|
||||||
|
|
||||||
details += [{
|
details += [{
|
||||||
:id => mission.id,
|
:id => mission.id,
|
||||||
|
@ -41,19 +41,28 @@ class MissionsController < ApplicationController
|
||||||
|
|
||||||
def detail
|
def detail
|
||||||
#Todo
|
#Todo
|
||||||
|
username = []
|
||||||
|
comments_s = []
|
||||||
mission_id = params[:id]
|
mission_id = params[:id]
|
||||||
mission = Mission.find_by(id: mission_id)
|
mission = Mission.find_by(id: mission_id)
|
||||||
userid = Mission_user.find_by_name("mission_id")
|
m_us = Missions_user.where("mission_id = ?",mission_id).all
|
||||||
username = User.find(userid).pluck("name")
|
#puts m_us.inspect
|
||||||
comments = []
|
m_us.each do |m_u|
|
||||||
Comments.where("mission_id" => id).each do |i|
|
user_id = m_u.user_id
|
||||||
name = User.find(i.user_id).name
|
user = User.find_by(id: user_id)
|
||||||
comments += [{
|
#puts user.inspect
|
||||||
:nickname => name,
|
username << user.name
|
||||||
:content => i.content,
|
end
|
||||||
:time => i.created_at
|
comments = Comment.where("mission_id = ?",mission_id).all
|
||||||
|
comments.each do |c|
|
||||||
|
uname = User.find_by(id: c.user_id).name
|
||||||
|
comments_s += [{
|
||||||
|
:nickname => uname,
|
||||||
|
:content => c.content,
|
||||||
|
:time => c.created_at
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
|
#puts comments_s.inspect
|
||||||
render :json => {
|
render :json => {
|
||||||
:code => 0,
|
:code => 0,
|
||||||
:data => {
|
:data => {
|
||||||
|
@ -63,41 +72,60 @@ class MissionsController < ApplicationController
|
||||||
:status => mission.status,
|
:status => mission.status,
|
||||||
:deadline => mission.deadline,
|
:deadline => mission.deadline,
|
||||||
:users => username,
|
:users => username,
|
||||||
:comments => comments
|
:comments => comments_s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
#======================================>创建任务
|
||||||
|
|
||||||
|
def create
|
||||||
|
#Todo
|
||||||
|
params_mission = {name: params[:name],project_id: params[:project_id],content: params[:content],deadline: params[:deadline],priority: params[:priority],status: params[:status]}
|
||||||
|
mission = Mission.new(params_mission)
|
||||||
|
mission.save
|
||||||
|
#puts mission.inspect
|
||||||
|
#puts mission.id
|
||||||
|
usernames = params[:users]
|
||||||
|
usernames.each do |name|
|
||||||
|
|
||||||
|
user_enties = User.find_by(name: name)
|
||||||
|
#puts user_enties.inspect
|
||||||
|
params_mu = {mission_id: mission.id,user_id: user_enties.id}
|
||||||
|
missions_user = Missions_user.new(params_mu)
|
||||||
|
missions_user.save
|
||||||
|
content = "有新任务:"+mission.name
|
||||||
|
|
||||||
|
params_note = {content: content,user_id: user_enties.id,category: 3,project_id: mission.project_id}
|
||||||
|
note = Note.new(params_note)
|
||||||
|
note.save
|
||||||
|
end
|
||||||
|
render :json => {:code => 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
#======================================>修改任务信息
|
#======================================>修改任务信息
|
||||||
|
|
||||||
def update
|
def update
|
||||||
#Todo
|
#Todo
|
||||||
|
|
||||||
id = params[:id]
|
id = params[:id]
|
||||||
now = Datetime.now
|
#now = Datetime.now
|
||||||
mission = Mission.find(id)
|
mission = Mission.find_by(id: id)
|
||||||
mission.name = params[:name]
|
params_mission = {name: params[:name],content: params[:content],deadline: params[:deadline],priority: params[:priority],status: params[:status]}
|
||||||
mission.content = params[:content]
|
#puts params_mission
|
||||||
mission.priority = params[:priority]
|
mission.update(params_mission)
|
||||||
mission.status = params[:status]
|
mission.save
|
||||||
mission.deadline = params[:deadline]
|
Missions_user.delete_all(["mission_id = ?",id])
|
||||||
mission.updated_at = now
|
usernames = params[:users]
|
||||||
mission.save!
|
usernames.each do |name|
|
||||||
pid = mission.project_id
|
user_enties = User.find_by(name: name)
|
||||||
Mission_user.destory_all(:mission_id => id)
|
params = {mission_id: id,user_id: user_enties.id}
|
||||||
params[:users].each do |i|
|
missions_user = Missions_user.new(params)
|
||||||
uid = User.where(:email => i).id
|
missions_user.save
|
||||||
mu = Mission_user.new
|
content = mission.name + "——任务信息发生了变化"
|
||||||
mu.mission_id = id
|
|
||||||
mu.user_id = uid
|
params_note = {content: content,user_id: user_enties.id,category: 3,project_id: mission.project_id}
|
||||||
mu.save!
|
note = Note.new(params_note)
|
||||||
note = Note.new
|
note.save
|
||||||
note.project_id = pid
|
|
||||||
note.user_id = uid
|
|
||||||
note.category = 3
|
|
||||||
note.created_at = now
|
|
||||||
note.updated_at = now
|
|
||||||
note.content = "任务信息发生了变化"
|
|
||||||
note.save!
|
|
||||||
end
|
end
|
||||||
render :json => {:code => 0}
|
render :json => {:code => 0}
|
||||||
end
|
end
|
||||||
|
@ -106,22 +134,15 @@ class MissionsController < ApplicationController
|
||||||
|
|
||||||
def commentPublish
|
def commentPublish
|
||||||
#Todo
|
#Todo
|
||||||
puts "I'm in"
|
|
||||||
content = params[:content]
|
|
||||||
mission_id = params[:mission_id]
|
mission_id = params[:mission_id]
|
||||||
|
content = params[:content]
|
||||||
user_id = session[:user_id]
|
user_id = session[:user_id]
|
||||||
puts user_id
|
params = {content: content, mission_id: mission_id, user_id: user_id}
|
||||||
params_comment = {content: content,mission_id: mission_id,user_id: user_id}
|
comment = Comment.new(params)
|
||||||
puts params_comment
|
comment.save
|
||||||
comment = Comments.new(params_comment)
|
|
||||||
|
|
||||||
# now = Datetime.now
|
|
||||||
# put.created_at = now
|
|
||||||
# put.updated_at = now
|
|
||||||
comment.save!
|
|
||||||
|
|
||||||
render :json => {:code => 0}
|
render :json => {:code => 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -8,23 +8,24 @@ class NotesController < ApplicationController
|
||||||
#Todo
|
#Todo
|
||||||
pid = params[:project_id]
|
pid = params[:project_id]
|
||||||
uid = session[:user_id]
|
uid = session[:user_id]
|
||||||
note = {}
|
notes = Note.where("user_id = ? AND project_id = ? ",uid,pid).order(:created_at).all
|
||||||
Note.where(:user_id => uid).where(:project_id => pid).each do |i|
|
note = Hash.new do |h,k|
|
||||||
date = i.created_at.to_date.to_s
|
h[k] = []
|
||||||
if not note[date] then
|
|
||||||
note[date] = []
|
|
||||||
end
|
end
|
||||||
note[:date] += [{
|
notes.each do |n|
|
||||||
:content => i.content,
|
date = n.created_at.to_s[/([\d\-]*)\s(.*)/,1]
|
||||||
:time => i.created_at.to_time,
|
time = n.created_at.to_s[/(.*)\s([\d\:]*)/,2]
|
||||||
:type => i.category
|
note[date] << {
|
||||||
}]
|
:content => n.content,
|
||||||
|
:time => time,
|
||||||
|
:type => n.category
|
||||||
|
}
|
||||||
end
|
end
|
||||||
data = []
|
data = []
|
||||||
note.each do |date, list|
|
note.each do |k,v|
|
||||||
data += [{
|
data += [{
|
||||||
:time => date,
|
:time => k,
|
||||||
:notes => list
|
:notes => v
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
render :json => {
|
render :json => {
|
||||||
|
|
|
@ -24,7 +24,6 @@ class SharesController < ApplicationController
|
||||||
else
|
else
|
||||||
render json: project.errors, status: :unprocessable_entity
|
render json: project.errors, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#获取项目的分享列表
|
#获取项目的分享列表
|
||||||
|
@ -32,6 +31,7 @@ class SharesController < ApplicationController
|
||||||
def getShareList
|
def getShareList
|
||||||
#Todo
|
#Todo
|
||||||
pid = params[:project_id]
|
pid = params[:project_id]
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
Share.where(:project_id => pid).order("created_at desc").each do |i|
|
Share.where(:project_id => pid).order("created_at desc").each do |i|
|
||||||
puts i.content
|
puts i.content
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
class Comment < ActiveRecord:: Base
|
class Comment < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :mission
|
belongs_to :mission
|
||||||
|
|
||||||
validates :content, presence: true
|
validates :content, presence: true
|
||||||
validates :mission_id, presence: true
|
validates :mission_id, presence: true
|
||||||
|
|
||||||
validates :user_id, presence: true
|
validates :user_id, presence: true
|
||||||
|
validate :comment_has_atleast_one_character, on: :create
|
||||||
validate :user_id_exist, on: :create
|
validate :user_id_exist, on: :create
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Missions_user <ActiveRecord:: Base
|
class Missions_user <ActiveRecord:: Base
|
||||||
|
|
||||||
validates :mission_id, presence: true, uniqueness: true
|
validates :mission_id, presence: true
|
||||||
validates :user_id, presence: true
|
validates :user_id, presence: true
|
||||||
|
|
||||||
validate :mission_exist, on: :create
|
validate :mission_exist, on: :create
|
||||||
|
|
|
@ -2,6 +2,7 @@ class Project < ActiveRecord::Base
|
||||||
has_and_belongs_to_many :users
|
has_and_belongs_to_many :users
|
||||||
|
|
||||||
validate :require_at_least_on_user,on: :update # 项目中最少要有一个用户
|
validate :require_at_least_on_user,on: :update # 项目中最少要有一个用户
|
||||||
|
|
||||||
validates :name, presence: true, length: { minimum: 1, maximum: 50 }, uniqueness: true
|
validates :name, presence: true, length: { minimum: 1, maximum: 50 }, uniqueness: true
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -73,8 +73,12 @@ Rails.application.routes.draw do
|
||||||
delete 'projects/users' => 'projects#deleteUsers'
|
delete 'projects/users' => 'projects#deleteUsers'
|
||||||
get 'projects/detail' => 'projects#detail'
|
get 'projects/detail' => 'projects#detail'
|
||||||
|
|
||||||
|
get 'notes/list' => 'notes#getNotesList'
|
||||||
|
|
||||||
get 'missions/project/status' => 'missions#getlist'
|
get 'missions/project/status' => 'missions#getlist'
|
||||||
get 'missions/detail' => 'missions#detail'
|
get 'missions/detail' => 'missions#detail'
|
||||||
patch 'missions/detail' => 'missions#update'
|
|
||||||
post 'missions/comments' => 'missions#commentPublish'
|
post 'missions/comments' => 'missions#commentPublish'
|
||||||
|
post 'missions/create' => 'missions#create'
|
||||||
|
patch 'missions/detail' => 'missions#update'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,62 +2,14 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe MissionsController, type: :controller do
|
RSpec.describe MissionsController, type: :controller do
|
||||||
|
|
||||||
# describe "GET #getlist" do
|
describe "GET #getlist" do
|
||||||
|
|
||||||
# it "return a valid json format of missions" do
|
|
||||||
|
|
||||||
# register = create(:user)
|
|
||||||
# user = User.find_by(email: register.email)
|
|
||||||
# session[:user_id] = user.id
|
|
||||||
|
|
||||||
# user1 = create(:user)
|
|
||||||
# user2 = create(:user)
|
|
||||||
# params = {name: "project addUsers test",content: "addUsers test"}
|
|
||||||
# project = Project.new(params)
|
|
||||||
# project.users << register
|
|
||||||
# project.save
|
|
||||||
|
|
||||||
# params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
|
||||||
# params_mission2 = {name: "mission2",content: "mission content2",deadline:"2016-10-17 10:00:00",priority:1,status:2,project_id: project.id}
|
|
||||||
# mission = Mission.new(params_mission)
|
|
||||||
# mission2 = Mission.new(params_mission2)
|
|
||||||
# mission.save
|
|
||||||
# mission2.save
|
|
||||||
# get :getlist,project_id: project.id,status_type: 1
|
|
||||||
|
|
||||||
# puts response.body
|
|
||||||
|
|
||||||
|
|
||||||
# end
|
|
||||||
|
|
||||||
# end
|
|
||||||
|
|
||||||
# describe "GET #detail" do
|
|
||||||
|
|
||||||
# it "return a correct json format detail" do
|
|
||||||
|
|
||||||
# register = create(:user)
|
|
||||||
# params = {name: "project addUsers test",content: "addUsers test"}
|
|
||||||
# project = Project.new(params)
|
|
||||||
# project.users << register
|
|
||||||
# project.save
|
|
||||||
|
|
||||||
# params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
|
||||||
# params_mission2 = {name: "mission2",content: "mission content2",deadline:"2016-10-17 10:00:00",priority:1,status:2,project_id: project.id}
|
|
||||||
# mission = Mission.new(params_mission)
|
|
||||||
# mission.save
|
|
||||||
# get :detail,id: mission.id
|
|
||||||
|
|
||||||
# end
|
|
||||||
|
|
||||||
# end
|
|
||||||
|
|
||||||
describe "POST #comments" do
|
|
||||||
|
|
||||||
it "can publish comments successfully" do
|
|
||||||
|
|
||||||
|
it "return a valid json format of missions" do
|
||||||
|
|
||||||
register = create(:user)
|
register = create(:user)
|
||||||
|
user = User.find_by(email: register.email)
|
||||||
|
session[:user_id] = user.id
|
||||||
|
|
||||||
params = {name: "project addUsers test",content: "addUsers test"}
|
params = {name: "project addUsers test",content: "addUsers test"}
|
||||||
project = Project.new(params)
|
project = Project.new(params)
|
||||||
project.users << register
|
project.users << register
|
||||||
|
@ -66,14 +18,133 @@ RSpec.describe MissionsController, type: :controller do
|
||||||
params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
||||||
params_mission2 = {name: "mission2",content: "mission content2",deadline:"2016-10-17 10:00:00",priority:1,status:2,project_id: project.id}
|
params_mission2 = {name: "mission2",content: "mission content2",deadline:"2016-10-17 10:00:00",priority:1,status:2,project_id: project.id}
|
||||||
mission = Mission.new(params_mission)
|
mission = Mission.new(params_mission)
|
||||||
|
mission2 = Mission.new(params_mission2)
|
||||||
|
mission.save
|
||||||
|
mission2.save
|
||||||
|
get :getlist,project_id: project.id,status_type: 1
|
||||||
|
|
||||||
|
puts response.body
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #detail" do
|
||||||
|
|
||||||
|
it "return a correct json format detail" do
|
||||||
|
|
||||||
|
register = create(:user)
|
||||||
|
session[:user_id] = register.id
|
||||||
|
params = {name: "project addUsers test",content: "addUsers test"}
|
||||||
|
project = Project.new(params)
|
||||||
|
project.users << register
|
||||||
|
project.save
|
||||||
|
|
||||||
|
params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
||||||
|
#params_mission2 = {name: "mission2",content: "mission content2",deadline:"2016-10-17 10:00:00",priority:1,status:2,project_id: project.id}
|
||||||
|
mission = Mission.new(params_mission)
|
||||||
mission.save
|
mission.save
|
||||||
|
|
||||||
post :comments , mission_id: mission.id,content: "用户评论"
|
post :commentPublish,content: "评论1",mission_id: mission.id
|
||||||
|
post :commentPublish,content: "评论2",mission_id: mission.id
|
||||||
|
|
||||||
|
get :detail,id: mission.id
|
||||||
|
|
||||||
puts "hello world"
|
|
||||||
puts response.body
|
puts response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "POST #comments" do
|
||||||
|
|
||||||
|
it "can publish comments successfully" do
|
||||||
|
|
||||||
|
|
||||||
|
register = create(:user)
|
||||||
|
params = {name: "project addUsers test",content: "addUsers test"}
|
||||||
|
session[:user_id] = register.id
|
||||||
|
project = Project.new(params)
|
||||||
|
project.users << register
|
||||||
|
project.save
|
||||||
|
|
||||||
|
params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
||||||
|
mission = Mission.new(params_mission)
|
||||||
|
mission.save
|
||||||
|
|
||||||
|
post :commentPublish,mission_id: mission.id,content: "asda"
|
||||||
|
|
||||||
|
puts response.body
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe "POST #update" do
|
||||||
|
|
||||||
|
it "can update missions successfully" 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
|
||||||
|
|
||||||
|
user1 = create(:user,name: "yangzhao")
|
||||||
|
user2 = create(:user,name: "chenyi")
|
||||||
|
|
||||||
|
user3 = create(:user,name: "yangzhao")
|
||||||
|
user4 = create(:user,name: "chenyi")
|
||||||
|
|
||||||
|
puts user1.inspect
|
||||||
|
params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
||||||
|
mission = Mission.new(params_mission)
|
||||||
|
mission.save
|
||||||
|
|
||||||
|
post :create,project_id: project.id,name: "前端原型开发",content:"开发出前端原型",priority:1,status:1,deadline:"2017-01-02 14:14:54",users: [user1.name,user2.name]
|
||||||
|
|
||||||
|
patch :update,name: "前端原型开发",id: mission.id,content:"完善前端原型",priority:1,status:1,deadline:"2017-01-03 14:14:54",users: [user3.name,user4.name]
|
||||||
|
|
||||||
|
post :detail,id: 1
|
||||||
|
puts response.body
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe "POST #create" do
|
||||||
|
|
||||||
|
it "can create missions successfully" 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
|
||||||
|
|
||||||
|
user1 = create(:user)
|
||||||
|
user2 = create(:user)
|
||||||
|
project.users << user1
|
||||||
|
project.users << user2
|
||||||
|
#params_mission = {name: "mission1",content: "mission content",deadline:"2016-10-17 10:00:00",priority:1,status:1,project_id: project.id}
|
||||||
|
|
||||||
|
post :create,project_id: project.id,name: "前端原型开发",content:"开发出前端原型",priority:1,status:1,deadline:"2017-01-02 10:00:00",users: [user1.name,user2.name]
|
||||||
|
|
||||||
|
post :detail,id: 1
|
||||||
|
|
||||||
|
puts response.body
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -0,0 +1,34 @@
|
||||||
|
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
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe SharesController,type: :controller do
|
||||||
|
|
||||||
|
describe "POST #create" do
|
||||||
|
|
||||||
|
it "create a correct share" do
|
||||||
|
|
||||||
|
register = create(:user)
|
||||||
|
user = User.find_by(email: register.email)
|
||||||
|
session[:user_id] = user.id
|
||||||
|
|
||||||
|
params = {name: "project addUsers test",content: "addUsers test"}
|
||||||
|
project = Project.new(params)
|
||||||
|
project.users << register
|
||||||
|
project.save
|
||||||
|
|
||||||
|
post :create,project_id: project.id,content: "苟利国家生死以,岂因福祸避趋之"
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET #getShareList" do
|
||||||
|
|
||||||
|
it "return correct share list" do
|
||||||
|
|
||||||
|
|
||||||
|
register = create(:user)
|
||||||
|
user = User.find_by(email: register.email)
|
||||||
|
session[:user_id] = user.id
|
||||||
|
|
||||||
|
params = {name: "project test",content: " test"}
|
||||||
|
project = Project.new(params)
|
||||||
|
project.users << register
|
||||||
|
project.save
|
||||||
|
|
||||||
|
post :create,project_id: project.id,content: "苟利国家生死以,岂因福祸避趋之"
|
||||||
|
|
||||||
|
post :create,project_id: project.id,content: "too young too simple"
|
||||||
|
|
||||||
|
post :create,project_id: project.id,content: "too young too naive"
|
||||||
|
|
||||||
|
|
||||||
|
get :getShareList,project_id: project.id
|
||||||
|
|
||||||
|
puts response.body
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue