-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for cadetship environment variables
- Loading branch information
Showing
3 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module KnapsackPro | ||
module Config | ||
module CI | ||
class Codeship < Base | ||
def node_total | ||
# not provided | ||
end | ||
|
||
def node_index | ||
# not provided | ||
end | ||
|
||
def node_build_id | ||
ENV['CI_BUILD_NUMBER'] | ||
end | ||
|
||
def commit_hash | ||
ENV['CI_COMMIT_ID'] | ||
end | ||
|
||
def branch | ||
ENV['CI_BRANCH'] | ||
end | ||
|
||
def project_dir | ||
# not provided | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
describe KnapsackPro::Config::CI::Codeship do | ||
let(:env) { {} } | ||
|
||
before do | ||
stub_const('ENV', env) | ||
end | ||
|
||
it { should be_kind_of KnapsackPro::Config::CI::Base } | ||
|
||
describe '#node_total' do | ||
subject { described_class.new.node_total } | ||
|
||
it { should be nil } | ||
end | ||
|
||
describe '#node_index' do | ||
subject { described_class.new.node_index } | ||
|
||
it { should be nil } | ||
end | ||
|
||
describe '#node_build_id' do | ||
subject { described_class.new.node_build_id } | ||
|
||
context 'when environment exists' do | ||
let(:env) { { 'CI_BUILD_NUMBER' => 2013 } } | ||
it { should eql 2013 } | ||
end | ||
|
||
context "when environment doesn't exist" do | ||
it { should be nil } | ||
end | ||
end | ||
|
||
describe '#commit_hash' do | ||
subject { described_class.new.commit_hash } | ||
|
||
context 'when environment exists' do | ||
let(:env) { { 'CI_COMMIT_ID' => 'a22aec3ee5d334fd658da35646b42bc5' } } | ||
it { should eql 'a22aec3ee5d334fd658da35646b42bc5' } | ||
end | ||
|
||
context "when environment doesn't exist" do | ||
it { should be nil } | ||
end | ||
end | ||
|
||
describe '#branch' do | ||
subject { described_class.new.branch } | ||
|
||
context 'when environment exists' do | ||
let(:env) { { 'CI_BRANCH' => 'master' } } | ||
it { should eql 'master' } | ||
end | ||
|
||
context "when environment doesn't exist" do | ||
it { should be nil } | ||
end | ||
end | ||
|
||
describe '#project_dir' do | ||
subject { described_class.new.project_dir } | ||
|
||
it { should be nil } | ||
end | ||
end |