Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
v4.0.1 (#277)
Browse files Browse the repository at this point in the history
* Update gem version to 4.0.1

* Update gem public certificate

* Reduce complexity of #finalize_config! spec
  • Loading branch information
ncs-alane authored Sep 16, 2018
1 parent fde5077 commit 93a2f97
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 177 deletions.
60 changes: 30 additions & 30 deletions certs/gem-public_cert.pem
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFjjCCA3agAwIBAgIBATANBgkqhkiG9w0BAQUFADBGMRMwEQYDVQQDDAphYXJv
bi5sYW5lMRowGAYKCZImiZPyLGQBGRYKbmV3Y29udGV4dDETMBEGCgmSJomT8ixk
ARkWA2NvbTAeFw0xNzA5MTQwMzMxNDJaFw0xODA5MTQwMzMxNDJaMEYxEzARBgNV
BAMMCmFhcm9uLmxhbmUxGjAYBgoJkiaJk/IsZAEZFgpuZXdjb250ZXh0MRMwEQYK
CZImiZPyLGQBGRYDY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
6SlE8WTS9Jx2647BAxjQNp8rmt4503z3MNZDN2Ee2xOi/9BLTrRNDEEN3KL06ekN
3a1KoEQv4Q34w3RJYUZTTH8758+X586wcpE4OSBpKmCmnnvnCQ41AmAgmulx3a23
eon/4r6QDaOet7GOW8HMlKSLokyAGlqqkJKasiAtYF8c1RBt4PRb7spsOyD1fx6d
2dOsEe8nC5AE+JUVLb51aXCaeBGr8kxJLBkPvOouI2fZxnh3T7IbKhJgHi0G4FU2
5p2nKeqcJkeGw8ZuVO58ttb4HELYgZgyr+WzhBjGaPLIF9sUvT0ou+feY67/Ds+K
E6ibwNPxBZra5x9wqeBoIKFu56CrTzBCL6EpY+gfhPSn2evJujccBjUcRi1w+V7z
eRjYOQaTg1OzJC8ZaGSVi8F69v7WSLwQKKn1NJtrGHzz3i1q/0vsin8WL7qluYh/
fjt+vfq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VHQ4EFgQUbK28Yq+mCLk/xOMb
jtmyPCaADm4wKwYDVR0RBCQwIoEga2l0Y2hlbi10ZXJyYWZvcm1AbmV3Y29udGV4
dC5jb20wKwYDVR0SBCQwIoEga2l0Y2hlbi10ZXJyYWZvcm1AbmV3Y29udGV4dC5j
b20wDQYJKoZIhvcNAQELBQADggIBABVPPNczpLVHm4HiZEw2ZD9AqKlHfK1PHQMG
DpPru7UQncjpoOfsP+wL0DS5dnvpNGAFm19ocee0bJEBFDyIOZTADQyA7MyXEUn7
w6SIz/Ie8btkpXg3cX198FIx2IA7fq3TcVVjIu0vbDuf9mrKxMJEKRlDYdfUhZOn
zTFztqn/Xt+owD24PUcujiokmypTdXcOF8afcrUP2IInod2Qayw/3ySVI7saJPvC
mg7cNYIvb2ssyHd7XMlxqDn17H+pvabScI13zj5v3Ge6a7K2b9P4VSaGIqr3zT+9
ijGQsefT1MmdxTvj1biF+0hK+P9l4QqGSmM0RpdiVXcEHhy707mRsfUxG2IuK3cp
wB8Hi7fIjsZmL2YSpJlmGExHe1FFw0QqtqOzgDQo1VQRpD3CWaX++75DoxGq9IBG
k+1oOIrNdUImdg0RJhWFaop7Y/aVHlFBR2d0Bt+7C/e0jtCyZ3rL+WgQYcgOTJyF
ls6shpevH3jhI1UcAxm7V+yKvbLSDgCu9L63CvUBVewNrCNjzsr3jqc6VujC0EDx
U10So+ucaa13hbq/ACED6RdSzw8RnHbsEqYsNi4X14EbLV64seKkxBcm7AhneqUP
BVaY4PA1920fVWRcwrNEzxNhWvlAlNCU9d63OhVIo1rD46E5/+fuWunp4ZyEJHIX
lema55cN
-----END CERTIFICATE-----
2 changes: 1 addition & 1 deletion lib/kitchen/terraform/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def temporarily_override(version:)

# @api private
def value
self.value = ::Gem::Version.new "4.0.0" if not @value
self.value = ::Gem::Version.new "4.0.1" if not @value
@value
end

Expand Down
158 changes: 61 additions & 97 deletions spec/lib/kitchen/terraform/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,121 +18,85 @@
require "kitchen/terraform/version"
require "rubygems"

::RSpec
.describe ::Kitchen::Terraform::Version do
subject do
described_class
end

let :version do
::Gem::Version.new "4.0.0"
end
::RSpec.describe ::Kitchen::Terraform::Version do
subject do
described_class
end

describe ".assign_plugin_version" do
let :configurable_class do
::Class
.new do
include ::Kitchen::Configurable
let :version do
::Gem::Version.new "4.0.1"
end

def self.read_plugin_version
@plugin_version
end
describe ".assign_plugin_version" do
let :configurable_class do
::Class.new do
class << self
def read_plugin_version
@plugin_version
end
end

specify "should assign the version to the plugin" do
expect do
subject.assign_plugin_version configurable_class: configurable_class
end
.to(
change(
configurable_class,
:read_plugin_version
)
.to(version.to_s)
)
end
end

describe ".assign_specification_version" do
let :specification do
::Gem::Specification.new
include ::Kitchen::Configurable
end
end

specify "should assign the version to the specification" do
expect do
subject.assign_specification_version specification: specification
end
.to(
change(
specification,
:version
)
.from(nil)
.to(version)
)
end
specify "should assign the version to the plugin" do
expect do
subject.assign_plugin_version configurable_class: configurable_class
end.to change(configurable_class, :read_plugin_version).to version.to_s
end
end

describe ".if_satisfies" do
context "when the requirement is satisfied by the version" do
specify do
expect do |block|
subject
.if_satisfies(
requirement: ::Gem::Requirement.new(">= 0"),
&block
)
end
.to yield_control
end
end
describe ".assign_specification_version" do
let :specification do
::Gem::Specification.new
end

context "when the requirement is not satisfied by the version" do
specify do
expect do |block|
subject
.if_satisfies(
requirement: "~> 0.0.1",
&block
)
end
.not_to yield_control
end
end
specify "should assign the version to the specification" do
expect do
subject.assign_specification_version specification: specification
end.to change(specification, :version).from(nil).to version
end
end

describe ".temporarily_override" do
let :target do
::String.new
describe ".if_satisfies" do
context "when the requirement is satisfied by the version" do
specify do
expect do |block|
subject.if_satisfies requirement: ::Gem::Requirement.new(">= 0"), &block
end.to yield_control
end
end

specify "should override the current version with the provided version before control is yielded" do
context "when the requirement is not satisfied by the version" do
specify do
expect do |block|
subject.temporarily_override version: "0.0.0" do
subject
.if_satisfies(
requirement: "< 1.0.0",
&block
)
end
end
.to yield_control
subject.if_satisfies requirement: "~> 0.0.1", &block
end.not_to yield_control
end
end
end

specify "should reset the version after control is returned" do
expect do |block|
subject
.temporarily_override version: "0.0.0" do
end
describe ".temporarily_override" do
let :target do
::String.new
end

subject
.if_satisfies(
requirement: version,
&block
)
specify "should override the current version with the provided version before control is yielded" do
expect do |block|
subject.temporarily_override version: "0.0.0" do
subject.if_satisfies requirement: "< 1.0.0", &block
end
.to yield_control
end
end.to yield_control
end

specify "should reset the version after control is returned" do
expect do |block|
subject.temporarily_override version: "0.0.0" do
end

subject.if_satisfies requirement: version, &block
end.to yield_control
end
end
end
76 changes: 27 additions & 49 deletions spec/support/kitchen/terraform/configurable_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,63 +18,41 @@
require "kitchen/driver/terraform"
require "support/kitchen/instance_context"

::RSpec
.shared_examples "Kitchen::Terraform::Configurable" do
describe "@api_version" do
subject do
described_class.instance_variable_get :@api_version
end

it do
is_expected.to eq 2
end
::RSpec.shared_examples "Kitchen::Terraform::Configurable" do
describe "@api_version" do
subject do
described_class
end

describe "@plugin_version" do
subject do
described_class.instance_variable_get :@plugin_version
end

it "equals the gem version" do
is_expected.to eq "4.0.0"
end
specify "should equal 2" do
expect(subject.instance_variable_get(:@api_version)).to eq 2
end
end

describe "#finalize_config" do
context "when the instance is undefined" do
subject do
lambda do
described_instance.finalize_config! nil
end
end
describe "@plugin_version" do
subject do
described_class
end

it do
is_expected
.to(
raise_error(
::Kitchen::ClientError,
"Instance must be provided to #{described_instance}"
)
)
end
end
it "equals the gem version" do
expect(subject.instance_variable_get(:@plugin_version)).to eq "4.0.1"
end
end

context "when the instance is defined" do
include_context "Kitchen::Instance"
describe "#finalize_config" do
subject do
described_instance
end

after do
described_instance.finalize_config! instance
end
include_context "Kitchen::Instance"

subject do
described_instance
end
after do
described_instance.finalize_config! instance
end

it do
is_expected.to receive(:validate_config!).ordered
is_expected.to receive(:expand_paths!).ordered
is_expected.to receive(:load_needed_dependencies!).ordered
end
end
specify "should call #validate_config! before calling #expand_paths!" do
is_expected.to receive(:validate_config!).ordered
is_expected.to receive(:expand_paths!).ordered
end
end
end

0 comments on commit 93a2f97

Please sign in to comment.