Skip to content

Commit

Permalink
Add Status model for use by deployment API
Browse files Browse the repository at this point in the history
[#82324094]
  • Loading branch information
bdehamer committed Nov 7, 2014
1 parent f2f00e9 commit c0e1f5c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/deployment_target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def remote_deployment_model(cert_file)
self.user = target.username
self.password = target.password

has_one :status, class_name: Status

self.ssl_options = {
verify_mode: OpenSSL::SSL::VERIFY_PEER,
ca_file: cert_file.path
Expand Down
7 changes: 7 additions & 0 deletions app/models/status.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Status < ApiModel
attr_accessor :overall, :services

def initialize(attrs={}, persisted=false)
super attrs
end
end
24 changes: 24 additions & 0 deletions spec/models/status_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'spec_helper'

describe Status do

it_behaves_like 'an api model'

describe 'attributes' do
it { should respond_to :overall }
it { should respond_to :services }
end

describe '#initialize' do

let(:attrs) { { overall: 'running', services: [] } }

subject { described_class.new(attrs) }

it 'initializes the object with the passed-in attrs' do
expect(subject.overall).to eq attrs[:overall]
expect(subject.services).to eq attrs[:services]
end
end

end

0 comments on commit c0e1f5c

Please sign in to comment.