aruba 1.0.0.pre.alpha.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +5 -5
  2. data/.github/PULL_REQUEST_TEMPLATE.md +2 -1
  3. data/.rspec +0 -1
  4. data/.rubocop.yml +46 -182
  5. data/.rubocop_todo.yml +216 -0
  6. data/.simplecov +7 -5
  7. data/.travis.yml +56 -40
  8. data/.yardopts +3 -0
  9. data/CHANGELOG.md +1312 -0
  10. data/CONTRIBUTING.md +175 -83
  11. data/Gemfile +5 -69
  12. data/LICENSE +1 -1
  13. data/README.md +58 -21
  14. data/Rakefile +27 -54
  15. data/appveyor.yml +7 -10
  16. data/aruba.gemspec +38 -19
  17. data/bin/console +3 -12
  18. data/cucumber.yml +4 -22
  19. data/exe/aruba +1 -1
  20. data/fixtures/cli-app/README.md +1 -1
  21. data/fixtures/cli-app/Rakefile +1 -1
  22. data/fixtures/cli-app/bin/aruba-test-cli +1 -1
  23. data/fixtures/cli-app/cli-app.gemspec +4 -4
  24. data/fixtures/cli-app/lib/cli/app.rb +1 -1
  25. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
  26. data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
  27. data/fixtures/cli-app/spec/spec_helper.rb +3 -2
  28. data/fixtures/empty-app/Rakefile +1 -1
  29. data/fixtures/empty-app/cli-app.gemspec +4 -4
  30. data/fixtures/empty-app/lib/cli/app.rb +0 -2
  31. data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
  32. data/fixtures/getting-started-app/Gemfile +1 -1
  33. data/lib/aruba/api.rb +8 -15
  34. data/lib/aruba/api/bundler.rb +16 -0
  35. data/lib/aruba/api/commands.rb +272 -0
  36. data/lib/aruba/api/core.rb +82 -43
  37. data/lib/aruba/api/environment.rb +24 -7
  38. data/lib/aruba/api/filesystem.rb +66 -64
  39. data/lib/aruba/api/text.rb +17 -11
  40. data/lib/aruba/aruba_path.rb +25 -111
  41. data/lib/aruba/basic_configuration.rb +8 -25
  42. data/lib/aruba/basic_configuration/option.rb +2 -2
  43. data/lib/aruba/cli.rb +4 -1
  44. data/lib/aruba/colorizer.rb +10 -99
  45. data/lib/aruba/command.rb +4 -0
  46. data/lib/aruba/config/jruby.rb +15 -5
  47. data/lib/aruba/config_wrapper.rb +17 -2
  48. data/lib/aruba/configuration.rb +107 -0
  49. data/lib/aruba/console.rb +5 -7
  50. data/lib/aruba/console/help.rb +5 -2
  51. data/lib/aruba/contracts/absolute_path.rb +3 -3
  52. data/lib/aruba/contracts/is_power_of_two.rb +2 -2
  53. data/lib/aruba/contracts/relative_path.rb +3 -3
  54. data/lib/aruba/cucumber.rb +0 -3
  55. data/lib/aruba/cucumber/command.rb +227 -190
  56. data/lib/aruba/cucumber/environment.rb +1 -1
  57. data/lib/aruba/cucumber/file.rb +56 -50
  58. data/lib/aruba/cucumber/hooks.rb +10 -63
  59. data/lib/aruba/cucumber/testing_frameworks.rb +76 -50
  60. data/lib/aruba/event_bus.rb +4 -2
  61. data/lib/aruba/event_bus/name_resolver.rb +10 -10
  62. data/lib/aruba/events.rb +2 -1
  63. data/lib/aruba/hooks.rb +3 -5
  64. data/lib/aruba/in_config_wrapper.rb +10 -3
  65. data/lib/aruba/initializer.rb +40 -34
  66. data/lib/aruba/matchers/base/base_matcher.rb +2 -11
  67. data/lib/aruba/matchers/base/message_indenter.rb +19 -0
  68. data/lib/aruba/matchers/base/object_formatter.rb +2 -7
  69. data/lib/aruba/matchers/collection/include_an_object.rb +11 -13
  70. data/lib/aruba/matchers/command/be_successfully_executed.rb +8 -4
  71. data/lib/aruba/matchers/command/have_exit_status.rb +16 -4
  72. data/lib/aruba/matchers/command/have_finished_in_time.rb +5 -5
  73. data/lib/aruba/matchers/command/have_output.rb +12 -5
  74. data/lib/aruba/matchers/command/have_output_on_stderr.rb +4 -2
  75. data/lib/aruba/matchers/command/have_output_on_stdout.rb +4 -2
  76. data/lib/aruba/matchers/command/have_output_size.rb +2 -2
  77. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +5 -7
  78. data/lib/aruba/matchers/directory/have_sub_directory.rb +10 -7
  79. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
  80. data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
  81. data/lib/aruba/matchers/file/be_an_existing_file.rb +5 -7
  82. data/lib/aruba/matchers/file/have_file_content.rb +4 -4
  83. data/lib/aruba/matchers/file/have_file_size.rb +8 -8
  84. data/lib/aruba/matchers/file/have_same_file_content.rb +9 -12
  85. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
  86. data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
  87. data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
  88. data/lib/aruba/matchers/path/have_permissions.rb +8 -8
  89. data/lib/aruba/matchers/string/include_output_string.rb +8 -10
  90. data/lib/aruba/matchers/string/match_output_string.rb +9 -11
  91. data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
  92. data/lib/aruba/platform.rb +0 -8
  93. data/lib/aruba/platforms/announcer.rb +60 -85
  94. data/lib/aruba/platforms/aruba_file_creator.rb +4 -2
  95. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +8 -3
  96. data/lib/aruba/platforms/aruba_logger.rb +22 -2
  97. data/lib/aruba/platforms/command_monitor.rb +15 -102
  98. data/lib/aruba/platforms/determine_disk_usage.rb +56 -19
  99. data/lib/aruba/platforms/filesystem_status.rb +9 -9
  100. data/lib/aruba/platforms/local_environment.rb +2 -2
  101. data/lib/aruba/platforms/simple_table.rb +3 -11
  102. data/lib/aruba/platforms/unix_command_string.rb +7 -4
  103. data/lib/aruba/platforms/unix_environment_variables.rb +19 -26
  104. data/lib/aruba/platforms/unix_platform.rb +18 -39
  105. data/lib/aruba/platforms/unix_which.rb +3 -2
  106. data/lib/aruba/platforms/windows_command_string.rb +20 -7
  107. data/lib/aruba/platforms/windows_environment_variables.rb +42 -30
  108. data/lib/aruba/platforms/windows_platform.rb +4 -0
  109. data/lib/aruba/platforms/windows_which.rb +9 -4
  110. data/lib/aruba/processes/basic_process.rb +21 -27
  111. data/lib/aruba/processes/debug_process.rb +16 -5
  112. data/lib/aruba/processes/in_process.rb +20 -9
  113. data/lib/aruba/processes/spawn_process.rb +64 -36
  114. data/lib/aruba/rspec.rb +28 -31
  115. data/lib/aruba/runtime.rb +16 -7
  116. data/lib/aruba/setup.rb +32 -17
  117. data/lib/aruba/tasks/docker_helpers.rb +4 -2
  118. data/lib/aruba/version.rb +1 -1
  119. metadata +194 -64
  120. data/History.md +0 -612
  121. data/bin/bootstrap +0 -34
  122. data/bin/build +0 -3
  123. data/bin/release +0 -3
  124. data/fixtures/spawn_process/stderr.sh +0 -3
  125. data/lib/aruba/api/command.rb +0 -309
  126. data/lib/aruba/api/deprecated.rb +0 -895
  127. data/lib/aruba/api/rvm.rb +0 -44
  128. data/lib/aruba/config.rb +0 -101
  129. data/lib/aruba/cucumber/rvm.rb +0 -3
  130. data/lib/aruba/in_process.rb +0 -14
  131. data/lib/aruba/jruby.rb +0 -4
  132. data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
  133. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
  134. data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
  135. data/lib/aruba/spawn_process.rb +0 -11
@@ -4,7 +4,7 @@
4
4
  # @param [Integer] status
5
5
  # The value of the exit status
6
6
  #
7
- # @return [TrueClass, FalseClass] The result
7
+ # @return [Boolean] The result
8
8
  #
9
9
  # false:
10
10
  # * if command does not have exit status
@@ -23,16 +23,28 @@ RSpec::Matchers.define :have_exit_status do |expected|
23
23
  @old_actual.stop
24
24
  @actual = actual.exit_status
25
25
 
26
- next false unless @old_actual.respond_to? :exit_status
26
+ unless @old_actual.respond_to? :exit_status
27
+ raise "Expected #{@old_actual} to respond to #exit_status"
28
+ end
27
29
 
28
30
  values_match? expected, @actual
29
31
  end
30
32
 
31
33
  failure_message do |actual|
32
- format(%(expected that command "%s" has exit status of "%s", but has "%s".), @old_actual.commandline, expected.to_s, actual.to_s)
34
+ format(
35
+ %(expected that command "%s" has exit status of "%s", but has "%s".),
36
+ @old_actual.commandline,
37
+ expected.to_s,
38
+ actual.to_s
39
+ )
33
40
  end
34
41
 
35
42
  failure_message_when_negated do |actual|
36
- format(%(expected that command "%s" does not have exit status of "%s", but has "%s".), @old_actual.commandline, expected.to_s, actual.to_s)
43
+ format(
44
+ %(expected that command "%s" does not have exit status of "%s", but has "%s".),
45
+ @old_actual.commandline,
46
+ expected.to_s,
47
+ actual.to_s
48
+ )
37
49
  end
38
50
  end
@@ -4,7 +4,7 @@ require 'rspec/expectations/version'
4
4
  # This matchers checks if <command> run too long. Say the timeout is 10
5
5
  # seconds and it takes <command> to finish in 15. This matchers will succeed.
6
6
  #
7
- # @return [TrueClass, FalseClass] The result
7
+ # @return [Boolean] The result
8
8
  #
9
9
  # false:
10
10
  # * if command not to run too long
@@ -24,7 +24,9 @@ RSpec::Matchers.define :have_finished_in_time do
24
24
  @old_actual = actual
25
25
  @actual = @old_actual.commandline
26
26
 
27
- next false unless @old_actual.respond_to? :timed_out?
27
+ unless @old_actual.respond_to? :timed_out?
28
+ raise "Expected #{@old_actual} to respond to #timed_out?"
29
+ end
28
30
 
29
31
  @old_actual.stop
30
32
 
@@ -32,6 +34,4 @@ RSpec::Matchers.define :have_finished_in_time do
32
34
  end
33
35
  end
34
36
 
35
- if RSpec::Expectations::Version::STRING >= '3.1'
36
- RSpec::Matchers.define_negated_matcher :run_too_long, :have_finished_in_time
37
- end
37
+ RSpec::Matchers.define_negated_matcher :run_too_long, :have_finished_in_time
@@ -1,7 +1,9 @@
1
+ require 'aruba/matchers/base/message_indenter'
2
+
1
3
  # @!method have_output
2
4
  # This matchers checks if <command> has created output
3
5
  #
4
- # @return [TrueClass, FalseClass] The result
6
+ # @return [Boolean] The result
5
7
  #
6
8
  # false:
7
9
  # * if command has not created output
@@ -17,7 +19,9 @@ RSpec::Matchers.define :have_output do |expected|
17
19
  match do |actual|
18
20
  @old_actual = actual
19
21
 
20
- next false unless @old_actual.respond_to? :output
22
+ unless @old_actual.respond_to? :output
23
+ raise "Expected #{@old_actual} to respond to #output"
24
+ end
21
25
 
22
26
  @old_actual.stop
23
27
 
@@ -29,8 +33,11 @@ RSpec::Matchers.define :have_output do |expected|
29
33
  diffable
30
34
 
31
35
  description { "have output: #{description_of expected}" }
32
- end
33
36
 
34
- if RSpec::Expectations::Version::STRING >= '3.0'
35
- RSpec::Matchers.alias_matcher :a_command_having_output, :have_output
37
+ failure_message do |_actual|
38
+ "expected `#{@old_actual.commandline}` to have output #{description_of expected}\n" \
39
+ "but was:\n#{Aruba::Matchers::Base::MessageIndenter.indent_multiline_message @actual}"
40
+ end
36
41
  end
42
+
43
+ RSpec::Matchers.alias_matcher :a_command_having_output, :have_output
@@ -1,7 +1,7 @@
1
1
  # @!method have_output_on_stderr
2
2
  # This matchers checks if <command> has created output on stderr
3
3
  #
4
- # @return [TrueClass, FalseClass] The result
4
+ # @return [Boolean] The result
5
5
  #
6
6
  # false:
7
7
  # * if command has not created output on stderr
@@ -17,7 +17,9 @@ RSpec::Matchers.define :have_output_on_stderr do |expected|
17
17
  match do |actual|
18
18
  @old_actual = actual
19
19
 
20
- next false unless @old_actual.respond_to? :stderr
20
+ unless @old_actual.respond_to? :stderr
21
+ raise "Expected #{@old_actual} to respond to #stderr"
22
+ end
21
23
 
22
24
  @old_actual.stop
23
25
 
@@ -1,7 +1,7 @@
1
1
  # @!method have_output_on_stdout
2
2
  # This matchers checks if <command> has created output on stdout
3
3
  #
4
- # @return [TrueClass, FalseClass] The result
4
+ # @return [Boolean] The result
5
5
  #
6
6
  # false:
7
7
  # * if command has not created output on stdout
@@ -17,7 +17,9 @@ RSpec::Matchers.define :have_output_on_stdout do |expected|
17
17
  match do |actual|
18
18
  @old_actual = actual
19
19
 
20
- next false unless @old_actual.respond_to? :stdout
20
+ unless @old_actual.respond_to? :stdout
21
+ raise "Expected #{@old_actual} to respond to #stdout"
22
+ end
21
23
 
22
24
  @old_actual.stop
23
25
 
@@ -4,7 +4,7 @@
4
4
  # @param [String] output
5
5
  # The content which should be checked
6
6
  #
7
- # @return [TrueClass, FalseClass] The result
7
+ # @return [Boolean] The result
8
8
  #
9
9
  # false:
10
10
  # * if output does not have size
@@ -18,7 +18,7 @@
18
18
  # end
19
19
  RSpec::Matchers.define :have_output_size do |expected|
20
20
  match do |actual|
21
- next false unless actual.respond_to? :size
21
+ raise "Expected #{actual} to respond to #size" unless actual.respond_to? :size
22
22
 
23
23
  @actual = actual.size
24
24
  values_match? expected, @actual
@@ -3,7 +3,7 @@ require 'rspec/expectations/version'
3
3
  # @!method be_an_existing_directory
4
4
  # This matchers checks if <directory> exists in filesystem
5
5
  #
6
- # @return [TrueClass, FalseClass] The result
6
+ # @return [Boolean] The result
7
7
  #
8
8
  # false:
9
9
  # * if directory does not exist
@@ -19,20 +19,18 @@ RSpec::Matchers.define :be_an_existing_directory do |_|
19
19
  match do |actual|
20
20
  stop_all_commands
21
21
 
22
- next false unless actual.is_a? String
22
+ raise 'String expected' unless actual.is_a? String
23
23
 
24
24
  directory?(actual)
25
25
  end
26
26
 
27
27
  failure_message do |actual|
28
- format("expected that directory \"%s\" exists", actual)
28
+ format('expected that directory "%s" exists', actual)
29
29
  end
30
30
 
31
31
  failure_message_when_negated do |actual|
32
- format("expected that directory \"%s\" does not exist", actual)
32
+ format('expected that directory "%s" does not exist', actual)
33
33
  end
34
34
  end
35
35
 
36
- if RSpec::Expectations::Version::STRING >= '3.0'
37
- RSpec::Matchers.alias_matcher :an_existing_directory, :be_an_existing_directory
38
- end
36
+ RSpec::Matchers.alias_matcher :an_existing_directory, :be_an_existing_directory
@@ -6,7 +6,7 @@ require 'rspec/expectations/version'
6
6
  # @param [Array] sub_directory
7
7
  # A list of sub-directory relative to current directory
8
8
  #
9
- # @return [TrueClass, FalseClass] The result
9
+ # @return [Boolean] The result
10
10
  #
11
11
  # false:
12
12
  # * if directory does not have sub-directory
@@ -23,7 +23,8 @@ require 'rspec/expectations/version'
23
23
  #
24
24
  # RSpec.describe do
25
25
  # it { expect('dir1.d').to have_sub_directory(['subdir.1.d', 'subdir.2.d']) }
26
- # it { expect(directories).to include a_directory_with_sub_directory(['subdir.1.d', 'subdir.2.d']) }
26
+ # it { expect(directories)
27
+ # . to include a_directory_with_sub_directory(['subdir.1.d', 'subdir.2.d']) }
27
28
  # end
28
29
  RSpec::Matchers.define :have_sub_directory do |expected|
29
30
  match do |actual|
@@ -40,14 +41,16 @@ RSpec::Matchers.define :have_sub_directory do |expected|
40
41
  diffable
41
42
 
42
43
  failure_message do |actual|
43
- format("expected that directory \"%s\" has the following sub-directories: %s.", actual.join(', '), expected)
44
+ format('expected that directory "%s" has the following sub-directories: %s.',
45
+ actual.join(', '),
46
+ expected)
44
47
  end
45
48
 
46
49
  failure_message_when_negated do |actual|
47
- format("expected that directory \"%s\" does not have the following sub-directories: %s.", actual.join(', '), expected)
50
+ format('expected that directory "%s" does not have the following sub-directories: %s.',
51
+ actual.join(', '),
52
+ expected)
48
53
  end
49
54
  end
50
55
 
51
- if RSpec::Expectations::Version::STRING >= '3.0'
52
- RSpec::Matchers.alias_matcher :a_directory_having_sub_directory, :have_sub_directory
53
- end
56
+ RSpec::Matchers.alias_matcher :a_directory_having_sub_directory, :have_sub_directory
@@ -3,7 +3,7 @@ require 'rspec/expectations/version'
3
3
  # @!method be_a_command_found_in_path
4
4
  # This matchers checks if <command> can be found in path
5
5
  #
6
- # @return [TrueClass, FalseClass] The result
6
+ # @return [Boolean] The result
7
7
  #
8
8
  # false:
9
9
  # * if command was not found in PATH
@@ -31,6 +31,4 @@ RSpec::Matchers.define :be_a_command_found_in_path do
31
31
  end
32
32
  end
33
33
 
34
- if RSpec::Expectations::Version::STRING >= '3.0'
35
- RSpec::Matchers.alias_matcher :a_command_found_in_path, :be_a_command_found_in_path
36
- end
34
+ RSpec::Matchers.alias_matcher :a_command_found_in_path, :be_a_command_found_in_path
@@ -4,7 +4,7 @@ require 'shellwords'
4
4
  # @!method be_an_existing_executable
5
5
  # This matchers checks if <file> exists in filesystem
6
6
  #
7
- # @return [TrueClass, FalseClass] The result
7
+ # @return [Boolean] The result
8
8
  #
9
9
  # false:
10
10
  # * if file does not exist
@@ -24,14 +24,12 @@ RSpec::Matchers.define :be_an_existing_executable do |_|
24
24
  end
25
25
 
26
26
  failure_message do |actual|
27
- format("expected that executable \"%s\" exists", actual)
27
+ format('expected that executable "%s" exists', actual)
28
28
  end
29
29
 
30
30
  failure_message_when_negated do |actual|
31
- format("expected that executable \"%s\" does not exist", actual)
31
+ format('expected that executable "%s" does not exist', actual)
32
32
  end
33
33
  end
34
34
 
35
- if RSpec::Expectations::Version::STRING >= '3.0'
36
- RSpec::Matchers.alias_matcher :an_existing_executable, :be_an_existing_executable
37
- end
35
+ RSpec::Matchers.alias_matcher :an_existing_executable, :be_an_existing_executable
@@ -3,7 +3,7 @@ require 'rspec/expectations/version'
3
3
  # @!method be_an_existing_file
4
4
  # This matchers checks if <file> exists in filesystem
5
5
  #
6
- # @return [TrueClass, FalseClass] The result
6
+ # @return [Boolean] The result
7
7
  #
8
8
  # false:
9
9
  # * if file does not exist
@@ -19,20 +19,18 @@ RSpec::Matchers.define :be_an_existing_file do |_|
19
19
  match do |actual|
20
20
  stop_all_commands
21
21
 
22
- next false unless actual.is_a? String
22
+ raise 'String expected' unless actual.is_a? String
23
23
 
24
24
  file?(actual)
25
25
  end
26
26
 
27
27
  failure_message do |actual|
28
- format("expected that file \"%s\" exists", actual)
28
+ format('expected that file "%s" exists', actual)
29
29
  end
30
30
 
31
31
  failure_message_when_negated do |actual|
32
- format("expected that file \"%s\" does not exist", actual)
32
+ format('expected that file "%s" does not exist', actual)
33
33
  end
34
34
  end
35
35
 
36
- if RSpec::Expectations::Version::STRING >= '3.0'
37
- RSpec::Matchers.alias_matcher :an_existing_file, :be_an_existing_file
38
- end
36
+ RSpec::Matchers.alias_matcher :an_existing_file, :be_an_existing_file
@@ -7,7 +7,7 @@ require 'rspec/expectations/version'
7
7
  # @param [String, Regexp, Matcher] content
8
8
  # Specifies the content of the file
9
9
  #
10
- # @return [TrueClass, FalseClass] The result
10
+ # @return [Boolean] The result
11
11
  #
12
12
  # false:
13
13
  # * if file does not exist
@@ -54,9 +54,9 @@ RSpec::Matchers.define :have_file_content do |expected|
54
54
  values_match?(@expected, @actual)
55
55
  end
56
56
 
57
+ diffable if expected.is_a? String
58
+
57
59
  description { "have file content: #{description_of expected}" }
58
60
  end
59
61
 
60
- if RSpec::Expectations::Version::STRING >= '3.0'
61
- RSpec::Matchers.alias_matcher :a_file_having_content, :have_file_content
62
- end
62
+ RSpec::Matchers.alias_matcher :a_file_having_content, :have_file_content
@@ -6,7 +6,7 @@ require 'rspec/expectations/version'
6
6
  # @param [Fixnum] size
7
7
  # The size to check
8
8
  #
9
- # @return [TrueClass, FalseClass] The result
9
+ # @return [Boolean] The result
10
10
  #
11
11
  # false:
12
12
  # * if path does not have size
@@ -33,15 +33,15 @@ RSpec::Matchers.define :have_file_size do |expected|
33
33
  values_match?(@expected, @actual)
34
34
  end
35
35
 
36
- failure_message do |actual|
37
- format("expected that file \"%s\" has size \"%s\", but has \"%s\"", @old_actual, @actual, @expected)
36
+ failure_message do |_actual|
37
+ format('expected that file "%s" has size "%s", but has "%s"',
38
+ @old_actual, @actual, @expected)
38
39
  end
39
40
 
40
- failure_message_when_negated do |actual|
41
- format("expected that file \"%s\" does not have size \"%s\", but has \"%s\"", @old_actual, @actual, @expected)
41
+ failure_message_when_negated do |_actual|
42
+ format('expected that file "%s" does not have size "%s", but has "%s"',
43
+ @old_actual, @actual, @expected)
42
44
  end
43
45
  end
44
46
 
45
- if RSpec::Expectations::Version::STRING >= '3.0'
46
- RSpec::Matchers.alias_matcher :a_file_of_size, :have_file_size
47
- end
47
+ RSpec::Matchers.alias_matcher :a_file_of_size, :have_file_size
@@ -1,15 +1,14 @@
1
1
  require 'rspec/expectations/version'
2
-
3
2
  require 'fileutils'
4
3
 
5
- # @!method have_same_file_content_like(file_name)
4
+ # @!method have_same_file_content_as(file_name)
6
5
  # This matchers checks if <file1> has the same content like <file2>
7
6
  #
8
7
  # @param [String] file_name
9
8
  # The name of the file which should be compared with the file in the
10
9
  # `expect()`-call.
11
10
  #
12
- # @return [TrueClass, FalseClass] The result
11
+ # @return [Boolean] The result
13
12
  #
14
13
  # false:
15
14
  # * if file1 is not equal file2
@@ -19,10 +18,10 @@ require 'fileutils'
19
18
  # @example Use matcher
20
19
  #
21
20
  # RSpec.describe do
22
- # it { expect(file1).to have_same_file_content_like(file2) }
23
- # it { expect(files).to include a_file_with_same_content_like(file2) }
21
+ # it { expect(file1).to have_same_file_content_as(file2) }
22
+ # it { expect(files).to include a_file_with_same_content_as(file2) }
24
23
  # end
25
- RSpec::Matchers.define :have_same_file_content_like do |expected|
24
+ RSpec::Matchers.define :have_same_file_content_as do |expected|
26
25
  match do |actual|
27
26
  stop_all_commands
28
27
 
@@ -31,18 +30,16 @@ RSpec::Matchers.define :have_same_file_content_like do |expected|
31
30
  @actual = expand_path(actual)
32
31
  @expected = expand_path(expected)
33
32
 
34
- FileUtils.compare_file(@actual,@expected)
33
+ FileUtils.compare_file(@actual, @expected)
35
34
  end
36
35
 
37
36
  failure_message do |actual|
38
- format("expected that file \"%s\" is the same as file \"%s\".", actual, expected)
37
+ format('expected that file "%s" is the same as file "%s".', actual, expected)
39
38
  end
40
39
 
41
40
  failure_message_when_negated do |actual|
42
- format("expected that file \"%s\" differs from file \"%s\".", actual, expected)
41
+ format('expected that file "%s" differs from file "%s".', actual, expected)
43
42
  end
44
43
  end
45
44
 
46
- if RSpec::Expectations::Version::STRING >= '3.0'
47
- RSpec::Matchers.alias_matcher :a_file_with_same_content_like, :have_same_file_content_like
48
- end
45
+ RSpec::Matchers.alias_matcher :a_file_with_same_content_as, :have_same_file_content_as
@@ -7,7 +7,7 @@ require 'rspec/expectations/version'
7
7
  # @param [String, Regexp, Matcher] pattern
8
8
  # Specifies the pattern
9
9
  #
10
- # @return [TrueClass, FalseClass] The result
10
+ # @return [Boolean] The result
11
11
  #
12
12
  # false:
13
13
  # * if pattern does not match
@@ -20,6 +20,4 @@ require 'rspec/expectations/version'
20
20
  # RSpec.describe do
21
21
  # it { expect(files).to include a_path_matching_pattern /asdf/ }
22
22
  # end
23
- if RSpec::Expectations::Version::STRING >= '3.0'
24
- RSpec::Matchers.alias_matcher :a_path_matching_pattern, :match
25
- end
23
+ RSpec::Matchers.alias_matcher :a_path_matching_pattern, :match
@@ -3,7 +3,7 @@ require 'rspec/expectations/version'
3
3
  # @!method be_an_absolute_path
4
4
  # This matchers checks if <path> exists in filesystem
5
5
  #
6
- # @return [TrueClass, FalseClass] The result
6
+ # @return [Boolean] The result
7
7
  #
8
8
  # false:
9
9
  # * if path is not absolute
@@ -27,10 +27,8 @@ RSpec::Matchers.define :be_an_absolute_path do |_|
27
27
  end
28
28
 
29
29
  failure_message_when_negated do |actual|
30
- format("expected that path \"%s\" is not absolute, but it is", actual)
30
+ format('expected that path "%s" is not absolute, but it is', actual)
31
31
  end
32
32
  end
33
33
 
34
- if RSpec::Expectations::Version::STRING >= '3.0'
35
- RSpec::Matchers.alias_matcher :an_absolute_path, :be_an_absolute_path
36
- end
34
+ RSpec::Matchers.alias_matcher :an_absolute_path, :be_an_absolute_path