Skip to content

Commit 8382afa

Browse files
authored
Avoid line continuations without parentheses. (thoughtbot#138)
This causes unexpected behaviour: The `not_to` spec will always pass, whilst the `to include` specs don't test for the presence of the command line, rather nothing. This is because Ruby treats the `include` as having no argument and the string below as a string literal. If we wrap in parentheses, the positive spec fails as the path is relative to the root partition. The solution here is to provide a full path when comparing `gemfile='...'`. This also fixes a broken expectation where `not_to` and `to` were flipped.
1 parent b18060f commit 8382afa

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

spec/acceptance/cli/install_spec.rb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636

3737
run 'appraisal install'
3838

39-
expect(content_of 'gemfiles/1.0.0.gemfile.lock').not_to include
40-
current_directory
39+
expect(content_of("gemfiles/1.0.0.gemfile.lock")).
40+
not_to include(current_directory)
4141
end
4242

4343
context 'with job size', :parallel => true do
@@ -52,19 +52,24 @@
5252
it 'accepts --jobs option to set job size' do
5353
output = run 'appraisal install --jobs=2'
5454

55-
expect(output).to include
56-
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=2'
55+
expect(output).to include(
56+
"bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=2"
57+
)
5758
end
5859

5960
it 'ignores --jobs option if the job size is less than or equal to 1' do
6061
output = run 'appraisal install --jobs=0'
6162

63+
expect(output).
64+
to include(
65+
"bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}'"
66+
)
6267
expect(output).not_to include(
63-
'bundle install --gemfile=gemfiles/1.0.0.gemfile')
68+
"bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=0"
69+
)
6470
expect(output).not_to include(
65-
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=0')
66-
expect(output).not_to include(
67-
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=1')
71+
"bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=1"
72+
)
6873
end
6974
end
7075
end

0 commit comments

Comments
 (0)