Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit c16e607

Browse files
Support ruby 2.7 (#150)
* QUA-542: Fix `message_prefix` function to avoid freeze exception * QUA-542: Remove `codeclimate-test-reporter` and config CC Test Coverage with Circle CI * QUA-542: update Circle CI config.yml * Bump ci's ruby version to ruby 2.7.5
1 parent 0caac62 commit c16e607

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

.circleci/config.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
version: 2
2-
1+
version: 2.0
32
jobs:
43
test:
4+
environment:
5+
CC_TEST_REPORTER_ID: ad21bc049a323138b0a88086069115e9df6dba417912095b7bb17b7a65fc6182
56
docker:
6-
- image: circleci/ruby:2.4.4
7-
setup_remote_docker:
8-
docker_layer_chaching: true
7+
- image: "circleci/ruby:2.7.5"
98
working_directory: ~/codeclimate/codeclimate-services
109
steps:
1110
- checkout
12-
- run: bundle install && bundle exec rake && bundle exec codeclimate-test-reporter
11+
- run:
12+
name: Setup Coverage
13+
command: |
14+
(curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > cc-test-reporter && chmod +x ./cc-test-reporter) || echo "Couldn't download test reporter"
15+
- run: bundle install && bundle exec rake
16+
- persist_to_workspace:
17+
root: .
18+
paths:
19+
- coverage
20+
- run: ./cc-test-reporter after-build --exit-code $? || echo "Send coverage skipped..."
1321

1422
workflows:
1523
version: 2

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.4
1+
2.7.5

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ gem "pry"
77

88
group :test do
99
gem "simplecov"
10-
gem "codeclimate-test-reporter", "~> 1.0.0"
1110
end

lib/cc/service/formatter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def service_title
1919
end
2020

2121
def message_prefix
22-
prefix = options.fetch(:prefix, "").to_s
22+
prefix = (options[:prefix] || "").to_s
2323

2424
if options[:prefix_with_repo]
2525
prefix << "[#{repo_name}]"

spec/cc/service/formatter_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
describe CC::Service::Formatter do
2+
3+
class TestFormatter < described_class
4+
def format_test
5+
message = message_prefix
6+
message << "This is a test"
7+
end
8+
end
9+
10+
FakeService = Struct.new(:receive)
11+
12+
it "supports passing nil as prefix" do
13+
formatter = TestFormatter.new(
14+
FakeService.new(:some_result),
15+
prefix: nil,
16+
prefix_with_repo: false,
17+
)
18+
19+
expect(formatter.format_test).to eq("This is a test")
20+
end
21+
end

0 commit comments

Comments
 (0)