aruba 0.11.0.pre4 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +11 -3
  3. data/README.md +32 -311
  4. data/aruba.gemspec +1 -1
  5. data/features/api/filesystem/fixtures.feature +104 -0
  6. data/features/{core/cleanup_aruba_directory.feature → getting_started/cleanup.feature} +16 -1
  7. data/features/{usage → getting_started}/install.feature +0 -0
  8. data/features/getting_started/writing_good_feature_tests.feature +38 -0
  9. data/features/hooks/after/command.feature +10 -0
  10. data/features/hooks/before/command.feature +10 -0
  11. data/features/platforms/jruby.feature +14 -0
  12. data/features/{commands/debug_command.feature → steps/command/debug.feature} +0 -0
  13. data/features/steps/command/in_process.feature +11 -0
  14. data/features/{commands → steps/command}/interactive.feature +1 -1
  15. data/features/{commands/output/all_output.feature → steps/command/output.feature} +142 -0
  16. data/features/steps/command/stderr.feature +68 -0
  17. data/features/{commands/output → steps/command}/stdout.feature +45 -2
  18. data/features/{announce.feature → steps/core/announce.feature} +0 -0
  19. data/features/steps/filesystem/append_to_file.feature +45 -0
  20. data/features/steps/filesystem/cd_to_directory.feature +33 -0
  21. data/features/steps/filesystem/check_file_content.feature +61 -0
  22. data/features/steps/filesystem/check_permissions_of_file.feature +39 -0
  23. data/features/steps/filesystem/compare_files.feature +42 -0
  24. data/features/steps/filesystem/create_directory.feature +15 -5
  25. data/features/steps/filesystem/create_file.feature +26 -3
  26. data/features/steps/filesystem/existence_of_directory.feature +57 -0
  27. data/features/steps/filesystem/existence_of_file.feature +43 -0
  28. data/features/steps/filesystem/file_content.feature +22 -0
  29. data/features/steps/filesystem/fixtures.feature +64 -0
  30. data/features/steps/filesystem/non_existence_of_directory.feature +69 -0
  31. data/features/steps/filesystem/non_existence_of_file.feature +80 -0
  32. data/features/steps/filesystem/remove_directory.feature +38 -0
  33. data/features/steps/filesystem/remove_file.feature +38 -0
  34. data/lib/aruba/cucumber/file.rb +17 -15
  35. data/lib/aruba/version.rb +1 -1
  36. metadata +52 -31
  37. data/features/commands/environment_variables.feature +0 -64
  38. data/features/commands/flushing.feature +0 -74
  39. data/features/file_system_commands.feature +0 -220
  40. data/features/output.feature +0 -131
  41. data/features/utf-8.feature +0 -14
  42. data/fixtures/fixtures-app/test.txt +0 -1
@@ -1,64 +0,0 @@
1
- Feature: Modify environment variables
2
-
3
- In order to test command line applications which make use of environment variables
4
- As a developer using Cucumber
5
- I want to use the command environment variable step
6
-
7
- Background:
8
- Given I use a fixture named "cli-app"
9
-
10
- Scenario: Change/Set value of arbitrary environment variable
11
- Given an executable named "bin/cli" with:
12
- """ruby
13
- #!/usr/bin/env ruby
14
-
15
- puts ENV['LONG_LONG_VARIABLE']
16
- """
17
- And a file named "features/environment_variable.feature" with:
18
- """cucumber
19
- Feature: Flushing output
20
- Scenario: Run command
21
- Given I set the environment variables to:
22
- | variable | value |
23
- | LONG_LONG_VARIABLE | long_value |
24
- When I run `cli`
25
- Then the output should contain "long_value"
26
- """
27
- When I run `cucumber`
28
- Then the features should all pass
29
-
30
- Scenario: Change the HOME-variable of current user during test using custom step
31
- Given an executable named "bin/cli" with:
32
- """ruby
33
- #!/usr/bin/env ruby
34
-
35
- puts File.expand_path('~/')
36
- """
37
- And a file named "features/home_directory.feature" with:
38
- """cucumber
39
- Feature: Run command with different home directory
40
- Scenario: Run command
41
- Given a mocked home directory
42
- When I run `cli`
43
- Then the output should contain "tmp/aruba"
44
- """
45
- When I run `cucumber`
46
- Then the features should all pass
47
-
48
- Scenario: Change the HOME-variable of current user during test using tag
49
- Given an executable named "bin/cli" with:
50
- """ruby
51
- #!/usr/bin/env ruby
52
-
53
- puts File.expand_path('~/')
54
- """
55
- And a file named "features/home_directory.feature" with:
56
- """cucumber
57
- Feature: Run command
58
- @mocked_home_directory
59
- Scenario: Run command
60
- When I run `cli`
61
- Then the output should contain "tmp/aruba"
62
- """
63
- When I run `cucumber`
64
- Then the features should all pass
@@ -1,74 +0,0 @@
1
- Feature: Flushing the output of your application
2
-
3
- In order to test processes that output a lot of data
4
- As a developer using Aruba
5
- I want to make sure that large amounts of output aren't buffered
6
-
7
- Background:
8
- Given I use a fixture named "cli-app"
9
-
10
- Scenario: A little output
11
- Given an executable named "bin/cli" with:
12
- """bash
13
- #!/usr/bin/env bash
14
-
15
- for ((c=0; c<256; c = c+1)); do
16
- echo -n "a"
17
- done
18
- """
19
- And a file named "features/flushing.feature" with:
20
- """cucumber
21
- Feature: Flushing output
22
- Scenario: Run command
23
- When I run `cli`
24
- Then the output should contain "a"
25
- And the output should be 256 bytes long
26
- And the exit status should be 0
27
- """
28
- When I run `cucumber`
29
- Then the features should all pass
30
-
31
- Scenario: Tons of output
32
- Given the default aruba exit timeout is 10 seconds
33
- And an executable named "bin/cli" with:
34
- """bash
35
- #!/usr/bin/env bash
36
-
37
- for ((c=0; c<65536; c = c+1)); do
38
- echo -n "a"
39
- done
40
- """
41
- And a file named "features/flushing.feature" with:
42
- """cucumber
43
- Feature: Flushing output
44
- Scenario: Run command
45
- When I run `cli`
46
- Then the output should contain "a"
47
- And the output should be 65536 bytes long
48
- And the exit status should be 0
49
- """
50
- When I run `cucumber`
51
- Then the features should all pass
52
-
53
- Scenario: Tons of interactive output
54
- Given the default aruba exit timeout is 10 seconds
55
- And an executable named "bin/cli" with:
56
- """bash
57
- #!/usr/bin/env bash
58
-
59
- read size; for ((c=0; c<$size; c = c+1)); do
60
- echo -n "a"
61
- done
62
- """
63
- And a file named "features/flushing.feature" with:
64
- """cucumber
65
- Feature: Flushing output
66
- Scenario: Run command
67
- When I run `cli` interactively
68
- And I type "65536"
69
- Then the output should contain "a"
70
- And the output should be 65536 bytes long
71
- And the exit status should be 0
72
- """
73
- When I run `cucumber`
74
- Then the features should all pass
@@ -1,220 +0,0 @@
1
- Feature: file system commands
2
-
3
- In order to specify commands that load files
4
- As a developer using Cucumber
5
- I want to create temporary files
6
-
7
- # Scenario: create a dir
8
- # Given a directory named "foo/bar"
9
- # When I run `file foo/bar`
10
- # Then the stdout should contain "foo/bar: directory"
11
-
12
- # Scenario: create a file
13
- # Given a file named "foo/bar/example.txt" with:
14
- # """
15
- # hello world
16
- # """
17
- # When I run `cat foo/bar/example.txt`
18
- # Then the output should contain exactly "hello world"
19
-
20
- Scenario: a file does not exist
21
- Given a file named "example.txt" does not exist
22
- Then the file "example.txt" should not exist
23
-
24
- Scenario: a directory does not exist
25
- Given a directory named "example.d" does not exist
26
- Then the directory "foo" should not exist
27
-
28
- Scenario: create a fixed sized file
29
- Given a 1048576 byte file named "test.txt"
30
- Then a 1048576 byte file named "test.txt" should exist
31
-
32
- Scenario: Append to a file
33
- \### We like appending to files:
34
- 1. Disk space is cheap
35
- 1. It's completely safe
36
-
37
- \### Here is a list:
38
- - One
39
- - Two
40
-
41
- Given a file named "foo/bar/example.txt" with:
42
- """
43
- hello world
44
-
45
- """
46
- When I append to "foo/bar/example.txt" with:
47
- """
48
- this was appended
49
-
50
- """
51
- When I run `cat foo/bar/example.txt`
52
- Then the stdout should contain "hello world"
53
- And the stdout should contain "this was appended"
54
-
55
- Scenario: Append to a new file
56
- When I append to "thedir/thefile" with "x"
57
- And I append to "thedir/thefile" with "y"
58
- Then the file "thedir/thefile" should contain "xy"
59
-
60
- Scenario: clean up files generated in previous scenario
61
- Then the file "foo/bar/example.txt" should not exist
62
-
63
- Scenario: change to a subdir
64
- Given a file named "foo/bar/example.txt" with:
65
- """
66
- hello world
67
-
68
- """
69
- When I cd to "foo/bar"
70
- And I run `cat example.txt`
71
- Then the output should contain "hello world"
72
-
73
- Scenario: Reset current directory from previous scenario
74
- When I run `pwd`
75
- Then the output should match /\057tmp\057aruba$/
76
-
77
- Scenario: Holler if cd to bad dir
78
- When I do aruba I cd to "foo/nonexistant"
79
- Then aruba should fail with "tmp/aruba/foo/nonexistant is not a directory"
80
-
81
- Scenario: Check for presence of a subset of files
82
- Given an empty file named "lorem/ipsum/dolor"
83
- Given an empty file named "lorem/ipsum/sit"
84
- Given an empty file named "lorem/ipsum/amet"
85
- Then the following files should exist:
86
- | lorem/ipsum/dolor |
87
- | lorem/ipsum/amet |
88
-
89
- Scenario: Check for absence of files
90
- Then the following files should not exist:
91
- | lorem/ipsum/dolor |
92
-
93
- Scenario: Check for presence of a single file
94
- Given an empty file named "lorem/ipsum/dolor"
95
- Then a file named "lorem/ipsum/dolor" should exist
96
-
97
- Scenario: Check for absence of a single file
98
- Then a file named "lorem/ipsum/dolor" should not exist
99
-
100
- Scenario: Check for absence of a single file using a regex
101
- Then a file matching %r<^ipsum> should not exist
102
-
103
- Scenario: Check for presence of a single file using a regex
104
- Given an empty file named "lorem/ipsum/dolor"
105
- Then a file matching %r<dolor$> should exist
106
-
107
- Scenario: Check for presence of a single file using a more complicated regex
108
- Given an empty file named "lorem/ipsum/dolor"
109
- Then a file matching %r<ipsum/dolor> should exist
110
-
111
- Scenario: Check for presence of a subset of directories
112
- Given a directory named "foo/bar"
113
- Given a directory named "foo/bla"
114
- Then the following directories should exist:
115
- | foo/bar |
116
- | foo/bla |
117
-
118
- Scenario: check for absence of directories
119
- Given a directory named "foo/bar"
120
- Given a directory named "foo/bla"
121
- Then the following step should fail with Spec::Expectations::ExpectationNotMetError:
122
- """
123
- Then the following directories should not exist:
124
- | foo/bar/ |
125
- | foo/bla/ |
126
- """
127
-
128
- Scenario: Check for presence of a single directory
129
- Given a directory named "foo/bar"
130
- Then a directory named "foo/bar" should exist
131
-
132
- Scenario: Check for absence of a single directory
133
- Given a directory named "foo/bar"
134
- Then the following step should fail with Spec::Expectations::ExpectationNotMetError:
135
- """
136
- Then the directory "foo/bar" should not exist
137
- """
138
-
139
- Scenario: Check file contents with text
140
- Given a file named "foo" with:
141
- """
142
- hello world
143
- """
144
- Then the file "foo" should contain "hello world"
145
- And the file "foo" should not contain "HELLO WORLD"
146
-
147
- Scenario: Check file contents with regexp
148
- Given a file named "foo" with:
149
- """
150
- hello world
151
- """
152
- Then the file "foo" should match /hel.o world/
153
- And the file "foo" should not match /HELLO WORLD/
154
-
155
- Scenario: Check file contents with docstring
156
- Given a file named "foo" with:
157
- """
158
- foo
159
- bar
160
- baz
161
- foobar
162
- """
163
- Then the file "foo" should contain:
164
- """
165
- bar
166
- baz
167
- """
168
-
169
- Scenario: Check file contents with another file
170
- Given a file named "foo" with:
171
- """
172
- hello world
173
- """
174
- And a file named "bar" with:
175
- """
176
- hello world
177
- """
178
- And a file named "nonbar" with:
179
- """
180
- hello another world
181
- """
182
- Then the file "foo" should be equal to file "bar"
183
- And the file "foo" should not be equal to file "nonbar"
184
-
185
- Scenario: Remove file
186
- Given a file named "foo" with:
187
- """
188
- hello world
189
- """
190
- When I remove the file "foo"
191
- Then the file "foo" should not exist
192
-
193
- Scenario: Remove directory
194
- Given a directory named "foo"
195
- When I remove the directory "foo"
196
- Then the directory "foo" should not exist
197
-
198
- Scenario: Just a dummy for reporting
199
- Given an empty file named "a/b.txt"
200
- Given an empty file named "a/b/c.txt"
201
- Given an empty file named "a/b/c/d.txt"
202
-
203
- Scenario: Change mode of empty file
204
- Given an empty file named "test.txt" with mode "0666"
205
- Then the mode of filesystem object "test.txt" should match "0666"
206
-
207
- Scenario: Change mode of a directory
208
- Given a directory named "test.d" with mode "0666"
209
- Then the mode of filesystem object "test.d" should match "0666"
210
-
211
- Scenario: Change mode of file
212
- Given a file named "test.txt" with mode "0666" and with:
213
- """
214
- asdf
215
- """
216
- Then the mode of filesystem object "test.txt" should match "0666"
217
-
218
- Scenario: Use a fixture
219
- Given I use a fixture named "fixtures-app"
220
- Then a file named "test.txt" should exist
@@ -1,131 +0,0 @@
1
- Feature: All output of commands which were executed
2
-
3
- In order to specify expected output
4
- As a developer using Cucumber
5
- I want to use the "the output should contain" step
6
-
7
- Background:
8
- Given I use a fixture named "cli-app"
9
-
10
- @requires-aruba-version-1
11
- Scenario: Detect output from all processes normal and interactive ones
12
- Given an executable named "bin/cli1" with:
13
- """
14
- #!/usr/bin/env bash
15
- echo 'This is cli1'
16
- """
17
- And an executable named "bin/cli2" with:
18
- """
19
- #!/usr/bin/env ruby
20
-
21
- while input = gets do
22
- break if "" == input
23
- puts input
24
- end
25
- """
26
- And a file named "features/output.feature" with:
27
- """
28
- Feature: Run command
29
- Scenario: Run command
30
- When I run `cli1`
31
- When I run `cli2` interactively
32
- And I type "This is cli2"
33
- And I type ""
34
- Then the stdout should contain exactly:
35
- \"\"\"
36
- This is cli1
37
- \"\"\"
38
- And the stdout should contain exactly:
39
- \"\"\"
40
- This is cli2
41
- \"\"\"
42
- """
43
- When I run `cucumber`
44
- Then the features should all pass
45
-
46
- Scenario: Detect stdout from all processes
47
- When I run `printf "hello world!\n"`
48
- And I run `cat` interactively
49
- And I type "hola"
50
- And I type ""
51
- Then the stdout should contain:
52
- """
53
- hello world!
54
- """
55
- And the stdout should contain:
56
- """
57
- hola
58
- """
59
- And the stderr should not contain anything
60
-
61
- Scenario: Detect stderr from all processes
62
- When I run `bash -c 'printf "hello world!\n" >&2'`
63
- And I run `bash -c 'cat >&2 '` interactively
64
- And I type "hola"
65
- And I type ""
66
- Then the stderr should contain:
67
- """
68
- hello world!
69
- """
70
- And the stderr should contain:
71
- """
72
- hola
73
- """
74
- And the stdout should not contain anything
75
-
76
- Scenario: Detect stderr from all processes (deprecated)
77
- When I run `bash -c 'printf "hello world!\n" >&2'`
78
- And I run `bash -c 'cat >&2 '` interactively
79
- And I type "hola"
80
- And I type ""
81
- Then the stderr should contain:
82
- """
83
- hello world!
84
- hola
85
- """
86
- And the stdout should not contain anything
87
-
88
- Scenario: Detect output from named source
89
- When I run `printf 'simple'`
90
- And I run `cat` interactively
91
- And I type "interactive"
92
- And I type ""
93
- Then the output from "printf 'simple'" should contain "simple"
94
- And the output from "printf 'simple'" should contain exactly "simple"
95
- And the output from "printf 'simple'" should contain exactly:
96
- """
97
- simple
98
- """
99
- And the output from "cat" should not contain "simple"
100
-
101
- Scenario: Detect stdout from named source
102
- When I run `printf 'hello'`
103
- And I run `printf 'goodbye'`
104
- Then the stdout from "printf 'hello'" should contain "hello"
105
- And the stdout from "printf 'hello'" should contain exactly "hello"
106
- And the stdout from "printf 'hello'" should contain exactly:
107
- """
108
- hello
109
- """
110
- And the stderr from "printf 'hello'" should not contain "hello"
111
- And the stdout from "printf 'goodbye'" should not contain "hello"
112
-
113
- Scenario: Detect stderr from named source
114
- When I run `bash -c 'printf hello >&2'`
115
- And I run `printf goodbye`
116
- Then the stderr from "bash -c 'printf hello >&2'" should contain "hello"
117
- And the stderr from "bash -c 'printf hello >&2'" should contain exactly "hello"
118
- And the stderr from "bash -c 'printf hello >&2'" should contain exactly:
119
- """
120
- hello
121
- """
122
- And the stdout from "bash -c 'printf hello >&2'" should not contain "hello"
123
- And the stderr from "printf goodbye" should not contain "hello"
124
-
125
- Scenario: Detect second output from named source with custom name
126
- When I set the environment variable "ARUBA_TEST_VAR" to "first"
127
- And I run `bash -c 'printf $ARUBA_TEST_VAR'`
128
- Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "first"
129
- When I set the environment variable "ARUBA_TEST_VAR" to "second"
130
- And I run `bash -c 'printf $ARUBA_TEST_VAR'`
131
- Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "second"