Skip to content

Commit 366d460

Browse files
committed
Merge branch 'cleanup'
2 parents ecd9717 + af6d668 commit 366d460

File tree

6 files changed

+70
-45
lines changed

6 files changed

+70
-45
lines changed

.appveyor.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ install:
55
- ruby --version
66
- bundle package --all
77

8-
- ps: git --work-tree=tmp\bin checkout origin/windows-binaries --
9-
advpng.exe gifsicle.exe jhead.exe jpeg-recompress.exe jpegoptim.exe
10-
jpegtran.exe optipng.exe pngcrush.exe pngout.exe pngquant.exe
8+
- ps: git --work-tree=tmp\bin checkout origin/windows-binaries -- '*.exe'
119

1210
- ps: | # svgo
1311
npm install -g svgo

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ AllCops:
33
- '*.gemspec'
44
- 'vendor/**/*'
55

6+
Bundler/OrderedGems:
7+
Enabled: false
8+
69
Lint/EndAlignment:
710
EnforcedStyleAlignWith: variable
811

.travis.yml

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,39 @@ language: ruby
33
cache:
44
bundler: true
55
directories:
6-
- $(npm root)
7-
- ~/bin
6+
- $(npm root)
7+
- ~/bin
88
rvm:
9-
- '1.8'
10-
- '1.9'
11-
- '2.0'
12-
- '2.1'
13-
- '2.2'
14-
- jruby-19mode
15-
- ree
16-
script: |
17-
(
18-
set -ex
19-
if [ -n "$RUBOCOP" ]; then
20-
bundle exec rubocop
21-
else
22-
bundle exec image_optim --info
23-
bundle exec rspec
24-
fi
25-
)
26-
before_install: |
27-
(
28-
set -ex
29-
if [ -z "$RUBOCOP" ]; then
30-
command -v svgo || npm install svgo
31-
command -v pngout || {
32-
mkdir -p ~/bin
33-
curl -L "http://static.jonof.id.au/dl/kenutils/pngout-20130221-linux.tar.gz" | tar -xz -C ~/bin --strip-components 2 --wildcards '*/x86_64/pngout'
34-
}
35-
fi
36-
)
37-
after_success:
38-
- if [ -n "$CODECLIMATE" ]; then bundle exec codeclimate-test-reporter; fi
9+
- '1.8.7-p371'
10+
- '1.9.3-p551'
11+
- '2.0.0-p648'
12+
- '2.1.10'
13+
- '2.2.6'
14+
- '2.3.3'
15+
- '2.4.0'
16+
- 'jruby-1.7.26'
17+
- 'jruby-9.0.5.0'
18+
- 'jruby-9.1.5.0'
19+
script:
20+
- bundle exec image_optim --info
21+
- bundle exec rspec
22+
before_install:
23+
- mkdir -p ~/bin
24+
- command -v svgo || npm install svgo
25+
- command -v pngout || curl -L "http://static.jonof.id.au/dl/kenutils/pngout-20130221-linux.tar.gz" | tar -xz -C ~/bin --strip-components 2 --wildcards '*/x86_64/pngout'
3926
matrix:
40-
fast_finish: true
4127
include:
42-
- env: CODECLIMATE=true
43-
rvm: '2'
44-
- env: RUBOCOP=true
45-
rvm: '2'
46-
allow_failures:
47-
- rvm: jruby-19mode
28+
- env: CODECLIMATE=✓
29+
rvm: '2.4.0'
30+
after_success: bundle exec codeclimate-test-reporter
31+
- env: RUBOCOP=✓
32+
rvm: '2.4.0'
33+
script: bundle exec rubocop
34+
before_install:
35+
- env: CHECK_RUBIES=✓
36+
rvm: '2.4.0'
37+
script: bundle exec travis_check_rubies
38+
before_install:
4839
addons:
4940
code_climate:
5041
repo_token:

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ if ENV['CODECLIMATE']
99
gem 'codeclimate-test-reporter'
1010
end
1111
end
12+
13+
if RUBY_VERSION >= '2.0'
14+
gem 'travis_check_rubies', '~> 0.2'
15+
gem 'rainbow', '!= 2.2.1' # TODO: remove when sickill/rainbow#44 is resolved
16+
end

spec/image_optim/option_definition_spec.rb

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@
6868
end
6969

7070
context 'when proc given' do
71-
subject{ described_class.new('abc', :def, 'desc', &:inspect) }
71+
subject do
72+
# not using &:inspect due to ruby Bug #13087
73+
# to_s is just to calm rubocop
74+
described_class.new('abc', :def, 'desc'){ |o| o.inspect.to_s }
75+
end
7276

7377
context 'when option not provided' do
7478
it 'returns default passed through proc' do
@@ -88,6 +92,30 @@
8892
end
8993
end
9094
end
95+
96+
context 'when proc with arity 2 given' do
97+
subject do
98+
described_class.new('abc', :def, 'desc'){ |a, b| [a.inspect, b] }
99+
end
100+
101+
context 'when option not provided' do
102+
it 'returns default passed through proc' do
103+
expect(subject.value(nil, {})).to eq([':def', subject])
104+
end
105+
end
106+
107+
context 'when option is nil' do
108+
it 'returns nil passed through proc' do
109+
expect(subject.value(nil, :abc => nil)).to eq(['nil', subject])
110+
end
111+
end
112+
113+
context 'when option is set' do
114+
it 'returns value passed through proc' do
115+
expect(subject.value(nil, :abc => 123)).to eq(['123', subject])
116+
end
117+
end
118+
end
91119
end
92120

93121
describe '#default_description' do

spec/image_optim_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def temp_copy(image)
204204
image_optim = ImageOptim.new
205205
results = test_images.map do |src|
206206
dst = double
207-
expect(image_optim).to receive(method).with(src).and_return(dst)
207+
allow(image_optim).to receive(method).with(src).and_return(dst)
208208
[src, dst]
209209
end
210210
expect(image_optim.send(list_method, test_images)).to eq(results)
@@ -217,7 +217,7 @@ def temp_copy(image)
217217
image_optim = ImageOptim.new
218218
results = test_images.map do |src|
219219
dst = double
220-
expect(image_optim).to receive(method).with(src).and_return(dst)
220+
allow(image_optim).to receive(method).with(src).and_return(dst)
221221
[src, dst, :test]
222222
end
223223
expect(image_optim.send(list_method, test_images) do |src, dst|

0 commit comments

Comments
 (0)