aruba 0.7.4 → 0.8.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.nav +12 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +12 -0
  6. data/.simplecov +2 -0
  7. data/.travis.yml +5 -6
  8. data/Gemfile +53 -26
  9. data/History.md +17 -0
  10. data/LICENSE +1 -1
  11. data/README.md +45 -19
  12. data/Rakefile +12 -2
  13. data/TODO.md +3 -0
  14. data/aruba.gemspec +19 -8
  15. data/cucumber.yml +1 -1
  16. data/features/api/cd.feature +119 -0
  17. data/features/api/command/run.feature +37 -0
  18. data/features/api/command/which.feature +37 -0
  19. data/features/api/environment/append_environment_variable.feature +118 -0
  20. data/features/api/environment/prepend_environment_variable.feature +118 -0
  21. data/features/api/environment/set_environment_variable.feature +252 -0
  22. data/features/configuration/exit_timeout.feature +51 -0
  23. data/features/configuration/fixtures_directories.feature +31 -0
  24. data/features/configuration/fixtures_path_prefix.feature +24 -0
  25. data/features/configuration/io_timeout.feature +31 -0
  26. data/features/configuration/keep_ansi.feature +31 -0
  27. data/features/configuration/root_directory.feature +31 -0
  28. data/features/configuration/working_directory.feature +32 -0
  29. data/features/fixtures/cli-app/.gitignore +9 -0
  30. data/features/fixtures/cli-app/.rspec +2 -0
  31. data/features/fixtures/cli-app/README.md +34 -0
  32. data/features/fixtures/cli-app/Rakefile +1 -0
  33. data/features/fixtures/cli-app/bin/cli +6 -0
  34. data/features/fixtures/cli-app/cli-app.gemspec +26 -0
  35. data/features/fixtures/cli-app/features/support/env.rb +1 -0
  36. data/features/fixtures/cli-app/lib/cli/app.rb +13 -0
  37. data/features/fixtures/cli-app/lib/cli/app/version.rb +5 -0
  38. data/features/fixtures/cli-app/script/console +14 -0
  39. data/features/fixtures/cli-app/spec/cli/app_spec.rb +7 -0
  40. data/features/fixtures/cli-app/spec/spec_helper.rb +10 -0
  41. data/features/fixtures/copy/file.txt +1 -1
  42. data/features/hooks/after/command.feature +34 -0
  43. data/features/hooks/before/command.feature +61 -0
  44. data/features/matchers/directory/have_sub_directory.feature +110 -0
  45. data/features/matchers/file/be_existing_file.feature +82 -0
  46. data/features/matchers/file/have_file_content.feature +123 -0
  47. data/features/matchers/file/have_file_size.feature +107 -0
  48. data/features/matchers/path/be_an_absolute_path.feature +74 -0
  49. data/features/matchers/path/be_an_existing_path.feature +97 -0
  50. data/features/matchers/path/have_permissions.feature +118 -0
  51. data/features/matchers/timeouts.feature +48 -0
  52. data/features/step_definitions/aruba_dev_steps.rb +69 -1
  53. data/features/steps/commands/exit_statuses.feature +136 -0
  54. data/features/steps/commands/in_process.feature +129 -0
  55. data/features/steps/commands/run.feature +36 -0
  56. data/features/steps/environment/home_variable.feature +49 -0
  57. data/features/steps/environment/set_environment_variable.feature +34 -0
  58. data/features/support/aruba.rb +5 -0
  59. data/features/support/env.rb +8 -4
  60. data/lib/aruba.rb +20 -8
  61. data/lib/aruba/announcer.rb +1 -0
  62. data/lib/aruba/api.rb +18 -1179
  63. data/lib/aruba/api/command.rb +351 -0
  64. data/lib/aruba/api/core.rb +141 -0
  65. data/lib/aruba/api/deprecated.rb +549 -0
  66. data/lib/aruba/api/environment.rb +61 -0
  67. data/lib/aruba/api/filesystem.rb +305 -0
  68. data/lib/aruba/api/rvm.rb +39 -0
  69. data/lib/aruba/aruba_path.rb +75 -0
  70. data/lib/aruba/basic_configuration.rb +208 -0
  71. data/lib/aruba/basic_configuration/option.rb +25 -0
  72. data/lib/aruba/config.rb +43 -30
  73. data/lib/aruba/config/jruby.rb +14 -0
  74. data/lib/aruba/config_wrapper.rb +17 -0
  75. data/lib/aruba/contracts/relative_path.rb +13 -0
  76. data/lib/aruba/creators/aruba_file_creator.rb +32 -0
  77. data/lib/aruba/creators/aruba_fixed_size_file_creator.rb +32 -0
  78. data/lib/aruba/cucumber.rb +87 -53
  79. data/lib/aruba/cucumber/hooks.rb +65 -10
  80. data/lib/aruba/environment.rb +121 -0
  81. data/lib/aruba/errors.rb +3 -0
  82. data/lib/aruba/extensions/string/strip.rb +24 -0
  83. data/lib/aruba/hooks.rb +54 -0
  84. data/lib/aruba/jruby.rb +4 -9
  85. data/lib/aruba/matchers/command.rb +1 -79
  86. data/lib/aruba/matchers/command/be_successfully_executed.rb +30 -0
  87. data/lib/aruba/matchers/command/have_exit_status.rb +47 -0
  88. data/lib/aruba/matchers/command/have_finished_in_time.rb +42 -0
  89. data/lib/aruba/matchers/directory.rb +1 -59
  90. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +34 -0
  91. data/lib/aruba/matchers/directory/have_sub_directory.rb +49 -0
  92. data/lib/aruba/matchers/file.rb +1 -177
  93. data/lib/aruba/matchers/file/be_an_existing_file.rb +34 -0
  94. data/lib/aruba/matchers/file/have_file_content.rb +58 -0
  95. data/lib/aruba/matchers/file/have_file_size.rb +43 -0
  96. data/lib/aruba/matchers/file/have_same_file_content.rb +44 -0
  97. data/lib/aruba/matchers/path.rb +1 -99
  98. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +21 -0
  99. data/lib/aruba/matchers/path/be_an_absolute_path.rb +32 -0
  100. data/lib/aruba/matchers/path/be_an_existing_path.rb +33 -0
  101. data/lib/aruba/matchers/path/have_permissions.rb +60 -0
  102. data/lib/aruba/matchers/path/match_path_pattern.rb +41 -0
  103. data/lib/aruba/matchers/rspec.rb +0 -0
  104. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +1 -1
  105. data/lib/aruba/platform.rb +230 -0
  106. data/lib/aruba/process_monitor.rb +23 -5
  107. data/lib/aruba/processes/basic_process.rb +35 -1
  108. data/lib/aruba/processes/debug_process.rb +26 -15
  109. data/lib/aruba/processes/in_process.rb +21 -9
  110. data/lib/aruba/processes/spawn_process.rb +29 -19
  111. data/lib/aruba/reporting.rb +2 -0
  112. data/lib/aruba/rspec.rb +61 -13
  113. data/lib/aruba/runtime.rb +33 -0
  114. data/script/bootstrap +4 -6
  115. data/spec/aruba/api/runtime_spec.rb +28 -0
  116. data/spec/aruba/api_spec.rb +129 -126
  117. data/spec/aruba/aruba_path_spec.rb +65 -0
  118. data/spec/aruba/basic_configuration_spec.rb +5 -0
  119. data/spec/aruba/config_wrapper_spec.rb +25 -0
  120. data/spec/aruba/configuration_spec.rb +5 -0
  121. data/spec/aruba/jruby_spec.rb +34 -18
  122. data/spec/aruba/matchers/directory_spec.rb +6 -7
  123. data/spec/aruba/matchers/file_spec.rb +16 -20
  124. data/spec/aruba/matchers/path_spec.rb +14 -11
  125. data/spec/aruba/rspec_spec.rb +15 -0
  126. data/spec/aruba/runtime_spec.rb +29 -0
  127. data/spec/aruba/spawn_process_spec.rb +2 -2
  128. data/spec/spec_helper.rb +10 -2
  129. data/spec/support/configs/rspec.rb +1 -1
  130. data/spec/support/matchers/option.rb +35 -0
  131. data/spec/support/shared_contexts/aruba.rb +10 -8
  132. data/spec/support/shared_examples/configuration.rb +116 -0
  133. metadata +182 -33
  134. data/.rvmrc +0 -1
  135. data/features/before_cmd_hooks.feature +0 -61
  136. data/features/command_environment_variables.feature +0 -31
  137. data/features/custom_ruby_process.feature +0 -12
  138. data/features/exit_statuses.feature +0 -30
  139. data/features/support/custom_main.rb +0 -28
  140. data/lib/aruba/matchers/mode.rb +0 -52
  141. data/lib/aruba/utils.rb +0 -21
@@ -0,0 +1,110 @@
1
+ Feature: Check if directory has given sub directories
2
+
3
+ If you need to check if a given directory has given sub dirctories, you can
4
+ use the `have_sub_directory`-matcher.
5
+
6
+ ```ruby
7
+ require 'spec_helper'
8
+
9
+ RSpec.describe 'Check if directory has sub-directory', :type => :aruba do
10
+ let(:file) { 'file.txt' }
11
+ before(:each) { touch(file) }
12
+
13
+ it { expect(file).to be_an_existing_file }
14
+ end
15
+ ```
16
+
17
+ Background:
18
+ Given I use a fixture named "cli-app"
19
+
20
+ Scenario: Expect existing sub directory
21
+ Given a file named "spec/existing_file_spec.rb" with:
22
+ """
23
+ require 'spec_helper'
24
+
25
+ RSpec.describe 'Check if directory has sub-directory', :type => :aruba do
26
+ let(:directory) { 'dir.d' }
27
+ let(:sub_directory) { 'sub-dir.d' }
28
+
29
+ before(:each) { create_directory(File.join(directory, sub_directory)) }
30
+
31
+ it { expect(directory).to have_sub_directory sub_directory }
32
+ end
33
+ """
34
+ When I run `rspec`
35
+ Then the specs should all pass
36
+
37
+ Scenario: Expect multiple existing sub directories
38
+ Given a file named "spec/existing_file_spec.rb" with:
39
+ """
40
+ require 'spec_helper'
41
+
42
+ RSpec.describe 'Check if directory has sub-directory', :type => :aruba do
43
+ let(:directory) { 'dir.d' }
44
+ let(:sub_directories) { %w(sub-dir1.d sub-dir2.d) }
45
+
46
+ before(:each) do
47
+ sub_directories.each { |d| create_directory(File.join(directory, d)) }
48
+ end
49
+
50
+ it { expect(directory).to have_sub_directory sub_directories }
51
+ end
52
+ """
53
+ When I run `rspec`
54
+ Then the specs should all pass
55
+
56
+ Scenario: Expect non-existing sub directory
57
+ Given a file named "spec/existing_file_spec.rb" with:
58
+ """
59
+ require 'spec_helper'
60
+
61
+ RSpec.describe 'Check if directory has sub-directory', :type => :aruba do
62
+ let(:directory) { 'dir.d' }
63
+ let(:sub_directory) { 'sub-dir.d' }
64
+
65
+ before(:each) { create_directory(directory) }
66
+
67
+ it { expect(directory).not_to have_sub_directory sub_directory }
68
+ end
69
+ """
70
+ When I run `rspec`
71
+ Then the specs should all pass
72
+
73
+ Scenario: Expect multiple directories have sub directory
74
+ Given a file named "spec/existing_file_spec.rb" with:
75
+ """
76
+ require 'spec_helper'
77
+
78
+ RSpec.describe 'Check if directory has sub-directory', :type => :aruba do
79
+ let(:directories) { %w(dir1.d dir2.d) }
80
+ let(:sub_directory) { 'sub-dir.d' }
81
+
82
+ before(:each) do
83
+ directories.each { |d| create_directory(File.join(d, sub_directory)) }
84
+ end
85
+
86
+ it { expect(directories).to all have_sub_directory sub_directory }
87
+ end
88
+ """
89
+ When I run `rspec`
90
+ Then the specs should all pass
91
+
92
+ Scenario: Expect a least one directory has sub directory
93
+ Given a file named "spec/existing_file_spec.rb" with:
94
+ """
95
+ require 'spec_helper'
96
+
97
+ RSpec.describe 'Check if directory has sub-directory', :type => :aruba do
98
+ let(:directories) { %w(dir1.d dir2.d) }
99
+ let(:sub_directory) { 'sub-dir.d' }
100
+
101
+ before(:each) do
102
+ create_directory(File.join(directories.first, sub_directory))
103
+ end
104
+
105
+ it { expect(directories).to include a_directory_having_sub_directory sub_directory }
106
+ end
107
+ """
108
+ When I run `rspec`
109
+ Then the specs should all pass
110
+
@@ -0,0 +1,82 @@
1
+ Feature: Check if path exists and is file
2
+
3
+ If you need to check if a given path exists and is a file, you can use the
4
+ `be_an_existing_file`-matcher.
5
+
6
+ ```ruby
7
+ require 'spec_helper'
8
+
9
+ RSpec.describe 'Check if file exists and is file', :type => :aruba do
10
+ let(:file) { 'file.txt' }
11
+ before(:each) { touch(file) }
12
+
13
+ it { expect(file).to be_an_existing_file }
14
+ end
15
+ ```
16
+
17
+ Background:
18
+ Given I use a fixture named "cli-app"
19
+
20
+ Scenario: Expect single existing file
21
+ Given a file named "spec/existing_file_spec.rb" with:
22
+ """
23
+ require 'spec_helper'
24
+
25
+ RSpec.describe 'Check if file exists and is file', :type => :aruba do
26
+ let(:file) { 'file.txt' }
27
+ before(:each) { touch(file) }
28
+ it { expect(file).to be_an_existing_file }
29
+ end
30
+ """
31
+ When I run `rspec`
32
+ Then the specs should all pass
33
+
34
+ Scenario: Expect single non-existing file
35
+ Given a file named "spec/existing_file_spec.rb" with:
36
+ """
37
+ require 'spec_helper'
38
+
39
+ RSpec.describe 'Check if file exists and is file', :type => :aruba do
40
+ let(:file) { 'file.txt' }
41
+ it { expect(file).not_to be_an_existing_file }
42
+ end
43
+ """
44
+ When I run `rspec`
45
+ Then the specs should all pass
46
+
47
+ Scenario: Expect multiple existing files
48
+ Given a file named "spec/existing_file_spec.rb" with:
49
+ """
50
+ require 'spec_helper'
51
+
52
+ RSpec.describe 'Check if file exists and is file', :type => :aruba do
53
+ let(:files) { %w(file1.txt file2.txt) }
54
+
55
+ before :each do
56
+ files.each { |f| touch(f) }
57
+ end
58
+
59
+ it { expect(files).to all be_an_existing_file }
60
+ end
61
+ """
62
+ When I run `rspec`
63
+ Then the specs should all pass
64
+
65
+ Scenario: Expect a least one existing file
66
+ Given a file named "spec/existing_file_spec.rb" with:
67
+ """
68
+ require 'spec_helper'
69
+
70
+ RSpec.describe 'Check if file exists and is file', :type => :aruba do
71
+ let(:files) { %w(file1.txt file2.txt) }
72
+
73
+ before :each do
74
+ touch(files.first)
75
+ end
76
+
77
+ it { expect(files).to include an_existing_file }
78
+ end
79
+ """
80
+ When I run `rspec`
81
+ Then the specs should all pass
82
+
@@ -0,0 +1,123 @@
1
+ Feature: Check if file has content
2
+
3
+ If you need to check if a given file has content, you can use the
4
+ `have_file_content`-matcher. It accepts `Object`, `Regexp` or any other
5
+ `RSpec::Matcher`-matchers. It fails if file does not exist.
6
+
7
+ ```ruby
8
+ require 'spec_helper'
9
+
10
+ RSpec.describe 'Check if file has content', :type => :aruba do
11
+ let(:file) { 'file.txt' }
12
+ let(:content) { 'Hello World' }
13
+
14
+ before(:each) { write_file(file, content) }
15
+
16
+ it { expect(file).to have_file_content content }
17
+ end
18
+ ```
19
+
20
+ Background:
21
+ Given I use a fixture named "cli-app"
22
+
23
+ Scenario: Expect existing file with content
24
+ Given a file named "spec/file_with_content_spec.rb" with:
25
+ """
26
+ require 'spec_helper'
27
+
28
+ RSpec.describe 'Check file content', :type => :aruba do
29
+ let(:file) { 'file.txt' }
30
+ let(:content) { 'Hello World' }
31
+
32
+ before(:each) { write_file(file, content) }
33
+
34
+ it { expect(file).to have_file_content content }
35
+ end
36
+ """
37
+ When I run `rspec`
38
+ Then the specs should all pass
39
+
40
+ Scenario: Expect existing file with partial content
41
+ Given a file named "spec/file_with_content_spec.rb" with:
42
+ """
43
+ require 'spec_helper'
44
+
45
+ RSpec.describe 'Check file content', :type => :aruba do
46
+ let(:file) { 'file.txt' }
47
+ let(:content) { 'Hello World' }
48
+
49
+ before(:each) { write_file(file, content) }
50
+
51
+ it { expect(file).to have_file_content /Hello/ }
52
+ end
53
+ """
54
+ When I run `rspec`
55
+ Then the specs should all pass
56
+
57
+ Scenario: Expect existing file with partial content described by another matcher
58
+ Given a file named "spec/file_with_content_spec.rb" with:
59
+ """
60
+ require 'spec_helper'
61
+
62
+ RSpec.describe 'Check file content', :type => :aruba do
63
+ let(:file) { 'file.txt' }
64
+ let(:content) { 'Hello World' }
65
+
66
+ before(:each) { write_file(file, content) }
67
+
68
+ it { expect(file).to have_file_content a_string_starting_with('Hello') }
69
+ end
70
+ """
71
+ When I run `rspec`
72
+ Then the specs should all pass
73
+
74
+ Scenario: Expect multiple existing files with content
75
+ Given a file named "spec/file_with_content_spec.rb" with:
76
+ """
77
+ require 'spec_helper'
78
+
79
+ RSpec.describe 'Check file content', :type => :aruba do
80
+ let(:files) { %w(file1.txt file2.txt) }
81
+ let(:content) { 'Hello World' }
82
+
83
+ before :each do
84
+ files.each { |f| write_file(f, content) }
85
+ end
86
+
87
+ it { expect(files).to all have_file_content content }
88
+ end
89
+ """
90
+ When I run `rspec`
91
+ Then the specs should all pass
92
+
93
+ Scenario: Expect at least one file with content
94
+ Given a file named "spec/file_with_content_spec.rb" with:
95
+ """
96
+ require 'spec_helper'
97
+
98
+ RSpec.describe 'Check file content', :type => :aruba do
99
+ let(:files) { %w(file1.txt file2.txt) }
100
+ let(:content) { 'Hello World' }
101
+
102
+ before(:each) { write_file(files.first, content) }
103
+
104
+ it { expect(files).to include a_file_having_content content }
105
+ end
106
+ """
107
+ When I run `rspec`
108
+ Then the specs should all pass
109
+
110
+ Scenario: Fails if file does not exist
111
+ Given a file named "spec/file_with_content_spec.rb" with:
112
+ """
113
+ require 'spec_helper'
114
+
115
+ RSpec.describe 'Check file content', :type => :aruba do
116
+ let(:file) { 'file.txt' }
117
+ let(:content) { 'Hello World' }
118
+
119
+ it { expect(file).to have_file_content content }
120
+ end
121
+ """
122
+ When I run `rspec`
123
+ Then the specs should not all pass
@@ -0,0 +1,107 @@
1
+ Feature: Check if path has size
2
+
3
+ If you need to check if a given path has file size, you can use the
4
+ `have_file_size`-matcher. It fails if the file does not exist.
5
+
6
+ ```ruby
7
+ require 'spec_helper'
8
+
9
+ RSpec.describe 'Check if file has size', :type => :aruba do
10
+ let(:file) { 'file.txt' }
11
+ let(:size) { 1 }
12
+
13
+ before(:each) { write_fixed_size_file(file, size) }
14
+
15
+ it { expect(file).to have_file_size size }
16
+ end
17
+ ```
18
+
19
+ Background:
20
+ Given I use a fixture named "cli-app"
21
+
22
+ Scenario: Expect file of given size
23
+ Given a file named "spec/file_of_size_spec.rb" with:
24
+ """
25
+ require 'spec_helper'
26
+
27
+ RSpec.describe 'Check if file has size', :type => :aruba do
28
+ let(:file) { 'file.txt' }
29
+ let(:size) { 1 }
30
+
31
+ before(:each) { write_fixed_size_file(file, size) }
32
+
33
+ it { expect(file).to have_file_size size }
34
+ end
35
+ """
36
+ When I run `rspec`
37
+ Then the specs should all pass
38
+
39
+ Scenario: Expect multiple files of given size
40
+ Given a file named "spec/file_of_size_spec.rb" with:
41
+ """
42
+ require 'spec_helper'
43
+
44
+ RSpec.describe 'Check if file has size', :type => :aruba do
45
+ let(:files) { %w(file1.txt file2.txt) }
46
+ let(:size) { 1 }
47
+
48
+ before :each do
49
+ files.each { |f| write_fixed_size_file(f, size) }
50
+ end
51
+
52
+ it { expect(files).to all have_file_size size }
53
+ end
54
+ """
55
+ When I run `rspec`
56
+ Then the specs should all pass
57
+
58
+ Scenario: Expect a least one file of size
59
+ Given a file named "spec/file_of_size_spec.rb" with:
60
+ """
61
+ require 'spec_helper'
62
+
63
+ RSpec.describe 'Check if file has size', :type => :aruba do
64
+ let(:files) { %w(file1.txt file2.txt) }
65
+ let(:size) { 1 }
66
+
67
+ before :each do
68
+ write_fixed_size_file(files.first, size)
69
+ end
70
+
71
+ it { expect(files).to include a_file_of_size size }
72
+ end
73
+ """
74
+ When I run `rspec`
75
+ Then the specs should all pass
76
+
77
+ Scenario: Fails because file has different size than expected
78
+ Given a file named "spec/file_of_size_spec.rb" with:
79
+ """
80
+ require 'spec_helper'
81
+
82
+ RSpec.describe 'Check if file has size', :type => :aruba do
83
+ let(:file) { 'file.txt' }
84
+ let(:size) { 1 }
85
+
86
+ before(:each) { write_fixed_size_file(file, size) }
87
+
88
+ it { expect(file).to have_file_size 2 }
89
+ end
90
+ """
91
+ When I run `rspec`
92
+ Then the specs should not all pass
93
+
94
+ Scenario: Fails if file does not exist
95
+ Given a file named "spec/file_of_size_spec.rb" with:
96
+ """
97
+ require 'spec_helper'
98
+
99
+ RSpec.describe 'Check if file has size', :type => :aruba do
100
+ let(:file) { 'file.txt' }
101
+ let(:size) { 1 }
102
+
103
+ it { expect(file).to have_file_size size }
104
+ end
105
+ """
106
+ When I run `rspec`
107
+ Then the specs should not all pass
@@ -0,0 +1,74 @@
1
+ Feature: Check if path is absolute
2
+
3
+ If you need to check if a given path is absolute , you can use the
4
+ `be_an_absolute_path`-matcher. It doesn't care if the path is a directory or
5
+ a path.
6
+
7
+ ```ruby
8
+ require 'spec_helper'
9
+
10
+ RSpec.describe 'Check if path is absolute', :type => :aruba do
11
+ let(:path) { 'file.txt' }
12
+ before(:each) { touch(path) }
13
+
14
+ it { expect(path).to be_an_absolute_path }
15
+ end
16
+ ```
17
+
18
+ Background:
19
+ Given I use a fixture named "cli-app"
20
+
21
+ Scenario: Expect single existing path
22
+ Given a file named "spec/absolute_path_spec.rb" with:
23
+ """
24
+ require 'spec_helper'
25
+
26
+ RSpec.describe 'Check if path is absolute', :type => :aruba do
27
+ let(:path) { '/path/to/file.txt' }
28
+ it { expect(path).to be_an_absolute_path }
29
+ end
30
+ """
31
+ When I run `rspec`
32
+ Then the specs should all pass
33
+
34
+ Scenario: Expect multiple absolute paths
35
+ Given a file named "spec/absolute_path_spec.rb" with:
36
+ """
37
+ require 'spec_helper'
38
+
39
+ RSpec.describe 'Check if path is absolute', :type => :aruba do
40
+ let(:paths) { %w(/path/to/path1.txt /path/to/path2.txt) }
41
+
42
+ it { expect(paths).to all be_an_absolute_path }
43
+ end
44
+ """
45
+ When I run `rspec`
46
+ Then the specs should all pass
47
+
48
+ Scenario: Expect a least one existing path
49
+ Given a file named "spec/absolute_path_spec.rb" with:
50
+ """
51
+ require 'spec_helper'
52
+
53
+ RSpec.describe 'Check if path is absolute', :type => :aruba do
54
+ let(:paths) { %w(/path/to/path1.txt path2.txt) }
55
+
56
+ it { expect(paths).to include an_absolute_path }
57
+ end
58
+ """
59
+ When I run `rspec`
60
+ Then the specs should all pass
61
+
62
+ Scenario: Expect failure on relative path
63
+ Given a file named "spec/absolute_path_spec.rb" with:
64
+ """
65
+ require 'spec_helper'
66
+
67
+ RSpec.describe 'Check if path is absolute', :type => :aruba do
68
+ let(:paths) { %w(path2.txt) }
69
+
70
+ it { expect(paths).to be_an_absolute_path }
71
+ end
72
+ """
73
+ When I run `rspec`
74
+ Then the specs should not all pass