Skip to content

Commit

Permalink
[frontend] Add a method to wrap ec2 upload_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Feb 20, 2018
1 parent f538cce commit 8701e06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/api/app/models/cloud/ec2/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class Configuration < ApplicationRecord
def self.table_name_prefix
'cloud_ec2_'
end

def upload_parameters
attributes.except('id', 'created_at', 'updated_at')
end
end
end
end
Expand Down
11 changes: 11 additions & 0 deletions src/api/spec/models/cloud/ec2/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,15 @@
it { is_expected.to allow_value('arn:123:456/tom').for(:arn) }
it { is_expected.not_to allow_value('123:456/tom').for(:arn) }
end

describe 'upload_parameters' do
let(:ec2_config) { create(:ec2_configuration) }

subject { ec2_config.upload_parameters }

it { expect(subject.keys.count).to be 3 }
it { expect(subject['arn']).to eq ec2_config.arn }
it { expect(subject['user_id']).to eq ec2_config.user_id }
it { expect(subject['external_id']).to eq ec2_config.external_id }
end
end

0 comments on commit 8701e06

Please sign in to comment.