Skip to content

Commit

Permalink
Merge pull request #142 from AishwaryaRK/pr
Browse files Browse the repository at this point in the history
add uuid in vpn creation using v1 api
  • Loading branch information
giosakti authored Feb 21, 2019
2 parents 4348897 + 2120c98 commit b24164a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/api/v1/vpns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ::Api::V1::VpnsController < ::Api::V1::BaseController
def create
if current_user.admin?
@vpn = Vpn.new(vpn_params)
@vpn.uuid = SecureRandom.uuid
if @vpn.save
render json: {
id: @vpn.id,
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/api/v1/vpns_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
vpn = Vpn.where(name: valid_attributes[:name]).first
expect(vpn.blank?).to eq(false)
expect(vpn.name).to eq(valid_attributes[:name])
expect(UUID.validate(vpn.uuid)).to eq(true)
end

it 'should return proper response' do
Expand Down

0 comments on commit b24164a

Please sign in to comment.