All Files
(62.5%
covered at
0.6
hits/line)
4 files in total.
64 relevant lines.
40 lines covered and
24 lines missed
-
1
require 'spec_helper'
-
-
1
RSpec.describe AutomateSoup::Change do
-
1
before(:all) do
-
1
@organization = ENV['AUTOMATE_ORG'] || 'test'
-
1
@project = ENV['AUTOMATE_PROJECT'] || 'coffee_docker'
-
1
@pipeline = ENV['AUTOMATE_PIPELINE'] || 'master'
-
1
@soup = AutomateSoup.setup(
-
url: ENV['AUTOMATE_URL'],
-
username: ENV['AUTOMATE_USERNAME'],
-
token: ENV['AUTOMATE_TOKEN'],
-
organization: @organization,
-
project: @project,
-
pipeline: @pipeline
-
)
-
1
@topic = @soup.change_by_topic(
-
topic: 'foobarbaz'
-
)
-
end
-
-
1
it 'should determine the topic stage' do
-
stage = @topic.current_stage
-
expect(stage).not_to be nil
-
end
-
-
1
it 'should approve a change or return nil if it cannot' do
-
topic = @topic
-
approve = topic.approve
-
if approve.nil?
-
expect(topic.current_stage.stage).not_to be nil
-
expect(topic.current_stage.stage).not_to eql 'approve'
-
else
-
expect(approve).to be true
-
end
-
end
-
-
1
it 'should deliver a change or return nil if it cannot' do
-
topic = @topic
-
deliver = topic.deliver
-
if deliver.nil?
-
expect(topic.current_stage.stage).not_to be nil
-
expect(topic.current_stage.stage).not_to eql 'approve'
-
else
-
expect(deliver).to be true
-
end
-
end
-
end
-
1
require 'spec_helper'
-
-
1
RSpec.describe AutomateSoup::Credentials do
-
1
it 'creates credentials with username/password' do
-
1
creds = AutomateSoup::Credentials.new(
-
username: 'test',
-
password: 'test'
-
)
-
1
expect(creds).not_to be nil
-
end
-
-
1
it 'creates credentials with username/token' do
-
1
creds = AutomateSoup::Credentials.new(
-
username: 'test',
-
token: 'test'
-
)
-
1
expect(creds).not_to be nil
-
end
-
end
-
1
require 'spec_helper'
-
-
1
RSpec.describe AutomateSoup do
-
1
it 'has a version number' do
-
1
expect(AutomateSoup::VERSION).not_to be nil
-
end
-
-
1
it 'creates a new instance of AutomateSoup with password' do
-
1
soup = AutomateSoup.setup(
-
url: 'test',
-
username: 'test',
-
password: 'test'
-
)
-
1
expect(soup).not_to be nil
-
end
-
-
1
it 'creates a new instance of AutomateSoup with token' do
-
1
soup = AutomateSoup.setup(
-
url: 'test',
-
username: 'test',
-
token: 'test'
-
)
-
1
expect(soup).not_to be nil
-
end
-
end
-
1
require 'spec_helper'
-
-
1
RSpec.describe AutomateSoup::Stage do
-
1
before(:all) do
-
1
@soup = AutomateSoup.setup(
-
url: ENV['AUTOMATE_URL'],
-
username: ENV['AUTOMATE_USERNAME'],
-
token: ENV['AUTOMATE_TOKEN']
-
)
-
1
@organization = ENV['AUTOMATE_ORG'] || 'test'
-
1
@project = ENV['AUTOMATE_PROJECT'] || 'coffee_docker'
-
1
@pipeline = ENV['AUTOMATE_PIPELINE'] || 'master'
-
1
@topic = @soup.change_by_topic(
-
organization: @organization,
-
project: @project,
-
pipeline: @pipeline,
-
topic: 'foobarbaz'
-
)
-
end
-
-
1
it 'should determine the status of the current stage' do
-
stage = @topic.current_stage
-
expect(stage.status).not_to be nil
-
end
-
-
1
it 'should determine if the stage passed' do
-
stage = @topic.current_stage
-
stage.status = 'passed'
-
expect(stage.passed?).not_to be nil
-
expect(stage.passed?).to be true
-
end
-
-
1
it 'should determine if the stage failed' do
-
stage = @topic.current_stage
-
stage.status = 'failed'
-
expect(stage.passed?).not_to be nil
-
expect(stage.passed?).to be false
-
end
-
end