trustieforge/spec/shared_account_spec.rb

43 lines
1.1 KiB
Ruby
Raw Normal View History

2015-05-15 13:39:26 +08:00
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