Skip to content

Commit d0a7ab7

Browse files
authored
Merge pull request #12 from mtsmfm/test-old-ruby
Test against old ruby
2 parents cf39fac + f7e3863 commit d0a7ab7

File tree

7 files changed

+49
-14
lines changed

7 files changed

+49
-14
lines changed

Dockerfile.development

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
FROM ruby:2.4.1
1+
ARG RUBY_VERSION=2.4.1
2+
FROM ruby:$RUBY_VERSION
23

34
RUN apt-get update && apt-get install less -y
45
RUN groupadd --gid 1000 ruby && useradd --uid 1000 --gid ruby --shell /bin/bash --create-home ruby
56
RUN mkdir /app && chown ruby:ruby /app
67

78
ENV LANG=C.UTF-8 \
8-
BUNDLE_PATH=/app/vendor/bundle \
9+
BUNDLE_PATH=/app/vendor/bundle/$RUBY_VERSION \
910
BUNDLE_JOBS=4
1011

1112
USER ruby

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ https://github.com/EugenMayer/docker-sync/wiki/1.-Installation
6161

6262
### Run test
6363

64-
$ docker-compose run app bundle exec rake test
64+
$ docker-compose run app bin/m
65+
$ docker-compose run ruby-2-3 bin/m
66+
$ docker-compose run ruby-2-2 bin/m
6567

6668
## Contributing
6769

circle.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,26 @@ jobs:
66
working_directory: /project
77
steps:
88
- checkout
9-
- setup_remote_docker
9+
- setup_remote_docker:
10+
version: 17.05.0-ce
1011
- run:
12+
name: setup
1113
command: |
1214
set -x
15+
docker info
1316
docker volume create mtsmfm-language-server-sync
1417
docker create -v mtsmfm-language-server-sync:/app --name mtsmfm-language-server-sync busybox chown -R 1000:1000 /app
1518
docker cp . mtsmfm-language-server-sync:/app
1619
docker start mtsmfm-language-server-sync
17-
docker-compose run node bin/generate_files
20+
docker-compose build
1821
docker-compose run app bin/setup
22+
docker-compose run ruby-2-3 bin/setup
23+
docker-compose run ruby-2-2 bin/setup
24+
- run:
25+
name: test
26+
command: |
27+
set -x
28+
docker-compose run node bin/generate_files
1929
docker-compose run app bin/m
30+
docker-compose run ruby-2-3 bin/m
31+
docker-compose run ruby-2-2 bin/m

docker-compose.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.0'
22
services:
3-
app:
4-
build:
3+
app: &app
4+
build: &app-build
55
context: .
66
dockerfile: Dockerfile.development
77
volumes:
@@ -10,6 +10,18 @@ services:
1010
- $HOME/.gitconfig:/home/ruby/.gitconfig:ro
1111
- $HOME/.ssh:/home/ruby/.ssh:ro
1212
- $HOME/.gem:/home/ruby/.gem
13+
ruby-2-3:
14+
<<: *app
15+
build:
16+
<<: *app-build
17+
args:
18+
RUBY_VERSION: 2.3
19+
ruby-2-2:
20+
<<: *app
21+
build:
22+
<<: *app-build
23+
args:
24+
RUBY_VERSION: 2.2
1325
node:
1426
build:
1527
context: .

test/language_server/completion_provider/rcodetools_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def setup
99
end
1010

1111
def test_array
12-
@file_store.cache(@uri, <<~EOS)
12+
@file_store.cache(@uri, <<-EOS.strip_heredoc)
1313
[].l
1414
EOS
1515

@@ -25,7 +25,7 @@ def test_array
2525
end
2626

2727
def test_no_candidates
28-
@file_store.cache(@uri, <<~EOS)
28+
@file_store.cache(@uri, <<-EOS.strip_heredoc)
2929
[].not_exists
3030
EOS
3131

@@ -35,7 +35,7 @@ def test_no_candidates
3535
end
3636

3737
def test_syntax_error
38-
@file_store.cache(@uri, <<~EOS)
38+
@file_store.cache(@uri, <<-EOS.strip_heredoc)
3939
class Foo
4040
[].l
4141
EOS
@@ -46,7 +46,7 @@ class Foo
4646
end
4747

4848
def test_runtime_error
49-
@file_store.cache(@uri, <<~EOS)
49+
@file_store.cache(@uri, <<-EOS.strip_heredoc)
5050
require "not_exists"
5151
[].l
5252
EOS

test/language_server/linter/ruby_wc_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module LanguageServer::Linter
44
class RubyWCTest < Minitest::Test
55
def test_error
6-
linter = RubyWC.new(<<~EOS)
6+
linter = RubyWC.new(<<-EOS.strip_heredoc)
77
require "foo
88
if a == "\\n"
99
EOS
@@ -14,9 +14,9 @@ def test_error
1414
end
1515

1616
def test_warn
17-
linter = RubyWC.new(<<~RUBY)
17+
linter = RubyWC.new(<<-EOS.strip_heredoc)
1818
a = 1
19-
RUBY
19+
EOS
2020

2121
assert {
2222
linter.call == [Error.new(line_num: 0, message: "assigned but unused variable - a", type: "warning")]

test/test_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@
44

55
require 'minitest/autorun'
66
require 'power_assert/colorize'
7+
8+
class String
9+
def strip_heredoc
10+
min = scan(/^[ \t]*(?=\S)/).min
11+
indent = min ? min.size : 0
12+
gsub(/^[ \t]{#{indent}}/, '')
13+
end
14+
end

0 commit comments

Comments
 (0)