Sha256: b4439e36df88692f31730bc1a58eafffc9da79b0af44e5aa5a35031403c5ec74
Contents?: true
Size: 1.44 KB
Versions: 8
Compression:
Stored size: 1.44 KB
Contents
require 'test_helper' module Shipit class CheckRunTest < ActiveSupport::TestCase setup do @commit = shipit_commits(:first) @stack = @commit.stack @check_run = shipit_check_runs(:second_pending_travis) end test ".create_or_update_from_github! is idempotent" do assert_difference -> { @commit.check_runs.count }, +1 do @commit.check_runs.create_or_update_from_github!(@stack.id, github_check_run) end assert_no_difference -> { @commit.check_runs.count } do @commit.check_runs.create_or_update_from_github!(@stack.id, github_check_run) end end { nil => 'pending', 'success' => 'success', 'failure' => 'failure', 'neutral' => 'success', 'cancelled' => 'failure', 'timed_out' => 'error', 'action_required' => 'pending', }.each do |conclusion, expected_status| test "#state is #{expected_status.inspect} when conclusion is #{conclusion.inspect}" do @check_run.update!(conclusion: conclusion) assert_equal expected_status, @check_run.state end end private def github_check_run @github_check_run ||= OpenStruct.new( id: 424_242, conclusion: 'success', output: OpenStruct.new( description: 'This is a description', ), name: 'Test Suite', html_url: 'http://example.com/run', details_url: 'http://example.com/details', ) end end end
Version data entries
8 entries across 8 versions & 1 rubygems