Guest User

Untitled

a guest
Nov 4th, 2016
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. desc 'Update FTP profile'
  2. params do
  3. use :token
  4. use :account_id
  5. requires :name, type: String
  6. requires :host, type: String
  7. requires :port, type: Integer
  8. requires :login, type: String
  9. requires :password, type: String
  10. end
  11. put :ftp_profile do
  12. user_owns_account?
  13. binding.pry
  14. profile = FtpProfile.find_by(account_id: params.account_id)
  15. profile.update_attributes(params)
  16. end
  17.  
  18.  
  19. it 'should update ftp profile' do
  20. user = create(:user)
  21. token = create(:api_token, user: user)
  22. ftp = create(:ftp_profile, account_id: user.user_accounts_relate.first.account_number)
  23. creds = {
  24. account_id: ftp.account_id,
  25. name: ftp.name,
  26. host: ftp.host,
  27. port: ftp.port,
  28. login: ftp.login,
  29. password: ftp.password,
  30. token: token.token
  31. }
  32.  
  33. put '/v1/user/ftp_profile', creds
  34. ftp_values = json_response_body.values_at(:name, :host, :login, :account_id)
  35. expect(last_response.status).to eq 200
  36. expect(ftp_values).to eq ftp.attributes.values_at('name', 'host', 'login', 'account_id')
  37. end
Add Comment
Please, Sign In to add comment