Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- desc 'Update FTP profile'
- params do
- use :token
- use :account_id
- requires :name, type: String
- requires :host, type: String
- requires :port, type: Integer
- requires :login, type: String
- requires :password, type: String
- end
- put :ftp_profile do
- user_owns_account?
- binding.pry
- profile = FtpProfile.find_by(account_id: params.account_id)
- profile.update_attributes(params)
- end
- it 'should update ftp profile' do
- user = create(:user)
- token = create(:api_token, user: user)
- ftp = create(:ftp_profile, account_id: user.user_accounts_relate.first.account_number)
- creds = {
- account_id: ftp.account_id,
- name: ftp.name,
- host: ftp.host,
- port: ftp.port,
- login: ftp.login,
- password: ftp.password,
- token: token.token
- }
- put '/v1/user/ftp_profile', creds
- ftp_values = json_response_body.values_at(:name, :host, :login, :account_id)
- expect(last_response.status).to eq 200
- expect(ftp_values).to eq ftp.attributes.values_at('name', 'host', 'login', 'account_id')
- end
Add Comment
Please, Sign In to add comment