Skip to content

Commit

Permalink
add spec tests for deployment_id
Browse files Browse the repository at this point in the history
  • Loading branch information
katjacresanti committed Sep 3, 2024
1 parent c452e91 commit 70e1896
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ group :development do
gem 'guard'
gem 'guard-minitest'
gem 'aws-sdk-codedeploy'
gem 'rspec'
end
19 changes: 17 additions & 2 deletions spec/egads_release_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# frozen_string_literal: true

require_relative 'spec_helper'

describe "Egads::Release" do
describe Egads::Release do
subject { Egads::Release }

let(:sha) { 'abcdef123456' }
let(:options) { { force: false, deployment_id: true } }
let(:release_instance) { subject.new([sha], options) }

it 'should run the correct tasks' do
_(subject.commands.keys).must_equal %w(setup_environment stage run_before_release_hooks symlink_release restart run_after_release_hooks trim)
expect(subject.commands.keys).to eq %w(setup_environment stage run_before_release_hooks symlink_release restart run_after_release_hooks trim)
end

it 'should recognize the deployment_id class option' do
expect(release_instance.options[:deployment_id]).to eq true
end

it 'should correctly pass the deployment_id option to the stage method' do
allow_any_instance_of(Egads::Stage).to receive(:stage).and_call_original
expect(release_instance.options[:deployment_id]).to eq(true)
end
end
19 changes: 17 additions & 2 deletions spec/egads_stage_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# frozen_string_literal: true

require_relative 'spec_helper'

describe "Egads::Stage" do
describe Egads::Stage do
subject { Egads::Stage }

let(:sha) { 'abcdef123456' }
let(:options) { { force: false, deployment_id: true } }
let(:stage_instance) { subject.new([sha], options) }

it 'should run the correct tasks' do
_(subject.commands.keys).must_equal %w(setup_environment extract run_before_hooks bundle symlink_system_paths symlink_config_files run_after_stage_hooks mark_as_staged)
expect(subject.commands.keys).to eq %w[setup_environment extract run_before_hooks bundle symlink_system_paths symlink_config_files run_after_stage_hooks mark_as_staged]
end

it 'should recognize the deployment_id class option' do
expect(stage_instance.options[:deployment_id]).to eq true
end

it 'should correctly pass the deployment_id option to the stage method' do
allow_any_instance_of(Egads::Stage).to receive(:stage).and_call_original
expect(stage_instance.options[:deployment_id]).to eq(true)
end
end

0 comments on commit 70e1896

Please sign in to comment.