mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
add another id-method test
Signed-off-by: Chris Redekop <chris.redekop@d2l.com>
This commit is contained in:
parent
5d00aac059
commit
1842cc2fd9
1 changed files with 21 additions and 13 deletions
|
@ -3,24 +3,32 @@ require 'helper'
|
||||||
require 'ec2'
|
require 'ec2'
|
||||||
|
|
||||||
class TestEc2 < Minitest::Test
|
class TestEc2 < Minitest::Test
|
||||||
def setup
|
Id = "instance-id"
|
||||||
@conn = Minitest::Mock.new
|
|
||||||
@client = Minitest::Mock.new
|
|
||||||
@resource = Minitest::Mock.new
|
|
||||||
|
|
||||||
@conn.expect :ec2_client, @client
|
def setup
|
||||||
@conn.expect :ec2_resource, @resource
|
@mockConn = Minitest::Mock.new
|
||||||
|
@mockClient = Minitest::Mock.new
|
||||||
|
@mockResource = Minitest::Mock.new
|
||||||
|
|
||||||
|
@mockConn.expect :ec2_client, @mockClient
|
||||||
|
@mockConn.expect :ec2_resource, @mockResource
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_that_id_returns_directly_provided_id
|
def test_that_id_returns_directly_provided_id
|
||||||
@cut = Ec2.new('i-foo', @conn)
|
@cut = Ec2.new(Id, @mockConn)
|
||||||
|
|
||||||
assert_equal @cut.id, 'i-foo'
|
assert_equal @cut.id, Id
|
||||||
end
|
end
|
||||||
|
|
||||||
# def test_that_id_returns_id_for_provided_name
|
def test_that_id_returns_id_for_provided_name
|
||||||
# @cut = Ec2.new({name: 'cut'}, @conn)
|
@cut = Ec2.new({name: 'cut'}, @mockConn)
|
||||||
#
|
mockInstance = Minitest::Mock.new
|
||||||
# assert_equal @cut.id, 'i-foo'
|
|
||||||
# end
|
mockInstance.expect :nil?, false
|
||||||
|
mockInstance.expect :id, Id
|
||||||
|
|
||||||
|
@mockResource.expect :instances, [mockInstance], [Hash]
|
||||||
|
|
||||||
|
assert_equal @cut.id, Id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue