You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
6 years ago
|
require 'rails_helper'
|
||
|
|
||
|
RSpec.shared_context "create user" do
|
||
|
let(:user) {FactoryGirl.attributes_for(:user)}
|
||
|
def shared_register
|
||
|
post register_path, user: user
|
||
|
end
|
||
|
|
||
|
def shared_update_user
|
||
|
post my_account_url,
|
||
|
login: user[:login],
|
||
|
identity: 0,
|
||
|
technical_title: "教授",
|
||
|
no: '',
|
||
|
"user[lastname]" => 'lastname',
|
||
|
"user[firstname]" => 'firstname',
|
||
|
enterprise_name: '',
|
||
|
gender: 1,
|
||
|
province: '',
|
||
|
occupation: "",
|
||
|
"user[mail]" => user[:mail],
|
||
|
"user[language]" => "zh",
|
||
|
province: '',
|
||
|
city: '',
|
||
|
"user[mail_notification]" => "all",
|
||
|
"user_extensions[birthday]" => '',
|
||
|
"user_extensions[gender]" => 1,
|
||
|
"user_extensions[brief_introduction]" => '',
|
||
|
"user_extensions[location]" => '',
|
||
|
"user_extensions[occupation]" => '',
|
||
|
"user_extensions[work_experience]" => '',
|
||
|
"user_extensions[zip_code]" => ''
|
||
|
end
|
||
|
|
||
|
def shared_login
|
||
|
post signin_path, username: user[:login], password: user[:password]
|
||
|
end
|
||
|
|
||
|
def current_user
|
||
|
User.find(session[:user_id])
|
||
|
end
|
||
|
end
|