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.
- checksums.yaml +4 -4
- data/History.md +11 -3
- data/README.md +32 -311
- data/aruba.gemspec +1 -1
- data/features/api/filesystem/fixtures.feature +104 -0
- data/features/{core/cleanup_aruba_directory.feature → getting_started/cleanup.feature} +16 -1
- data/features/{usage → getting_started}/install.feature +0 -0
- data/features/getting_started/writing_good_feature_tests.feature +38 -0
- data/features/hooks/after/command.feature +10 -0
- data/features/hooks/before/command.feature +10 -0
- data/features/platforms/jruby.feature +14 -0
- data/features/{commands/debug_command.feature → steps/command/debug.feature} +0 -0
- data/features/steps/command/in_process.feature +11 -0
- data/features/{commands → steps/command}/interactive.feature +1 -1
- data/features/{commands/output/all_output.feature → steps/command/output.feature} +142 -0
- data/features/steps/command/stderr.feature +68 -0
- data/features/{commands/output → steps/command}/stdout.feature +45 -2
- data/features/{announce.feature → steps/core/announce.feature} +0 -0
- data/features/steps/filesystem/append_to_file.feature +45 -0
- data/features/steps/filesystem/cd_to_directory.feature +33 -0
- data/features/steps/filesystem/check_file_content.feature +61 -0
- data/features/steps/filesystem/check_permissions_of_file.feature +39 -0
- data/features/steps/filesystem/compare_files.feature +42 -0
- data/features/steps/filesystem/create_directory.feature +15 -5
- data/features/steps/filesystem/create_file.feature +26 -3
- data/features/steps/filesystem/existence_of_directory.feature +57 -0
- data/features/steps/filesystem/existence_of_file.feature +43 -0
- data/features/steps/filesystem/file_content.feature +22 -0
- data/features/steps/filesystem/fixtures.feature +64 -0
- data/features/steps/filesystem/non_existence_of_directory.feature +69 -0
- data/features/steps/filesystem/non_existence_of_file.feature +80 -0
- data/features/steps/filesystem/remove_directory.feature +38 -0
- data/features/steps/filesystem/remove_file.feature +38 -0
- data/lib/aruba/cucumber/file.rb +17 -15
- data/lib/aruba/version.rb +1 -1
- metadata +52 -31
- data/features/commands/environment_variables.feature +0 -64
- data/features/commands/flushing.feature +0 -74
- data/features/file_system_commands.feature +0 -220
- data/features/output.feature +0 -131
- data/features/utf-8.feature +0 -14
- data/fixtures/fixtures-app/test.txt +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Cleanup Aruba Working Directory
|
2
2
|
|
3
3
|
By default Aruba removes its scratch directory before
|
4
4
|
every scenario. This isn't always the right thing
|
@@ -50,3 +50,18 @@ Feature: No clobber
|
|
50
50
|
"""
|
51
51
|
When I run `cucumber`
|
52
52
|
Then the features should all pass
|
53
|
+
|
54
|
+
Scenario: Current directory from previous scenario is reseted
|
55
|
+
Given a file named "features/non-existence.feature" with:
|
56
|
+
"""
|
57
|
+
Feature: Reset
|
58
|
+
Scenario: Reset #1
|
59
|
+
Given a directory named "dir1"
|
60
|
+
When I cd to "dir1"
|
61
|
+
|
62
|
+
Scenario: Reset #2
|
63
|
+
When I run `pwd`
|
64
|
+
Then the output should match %r</tmp/aruba$>
|
65
|
+
"""
|
66
|
+
When I run `cucumber`
|
67
|
+
Then the features should all pass
|
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Feature: Writing good feature tests with aruba to create documentations
|
2
|
+
|
3
|
+
You can use Markdown within your feature tests. This is quite good to write a
|
4
|
+
living documentation.
|
5
|
+
|
6
|
+
There are some edge cases where Gherkin and Markdown don't agree. Bullet lists
|
7
|
+
using `*` is one example. The `*` is also an alias for step keywords in
|
8
|
+
Gherkin. Markdown headers (the kind starting with a `#`) is another example.
|
9
|
+
They are parsed as comments by Gherkin. To use either of these, just escape
|
10
|
+
them with a backslash. Alternatively just use the "-".
|
11
|
+
|
12
|
+
You'd write:
|
13
|
+
|
14
|
+
```gherkin
|
15
|
+
Scenario: Make tea
|
16
|
+
\## Making tea
|
17
|
+
\* Get a pot
|
18
|
+
\* And some hot water
|
19
|
+
|
20
|
+
Given...
|
21
|
+
```
|
22
|
+
|
23
|
+
This way Gherkin won't recognize these lines as special tokens, and the
|
24
|
+
reporter will render them as Markdown. (The reporter strips away any leading
|
25
|
+
the backslashes before handing it off to the Markdown parser).
|
26
|
+
|
27
|
+
Another option is to use alternative Markdown syntax and omit conflicts and
|
28
|
+
escaping altogether:
|
29
|
+
|
30
|
+
```gherkin
|
31
|
+
Scenario: Make tea
|
32
|
+
Making tea
|
33
|
+
----------
|
34
|
+
- Get a pot
|
35
|
+
- And some hot water
|
36
|
+
|
37
|
+
Given...
|
38
|
+
```
|
@@ -3,6 +3,16 @@ Feature: After command hooks
|
|
3
3
|
You can configure Aruba to run blocks of code after it has run
|
4
4
|
a command. The command will be passed to the block.
|
5
5
|
|
6
|
+
You can hook into Aruba's lifecycle just before it runs a command and after it has run the command:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
Aruba.configure do |config|
|
10
|
+
config.after :command do |cmd|
|
11
|
+
puts "After the run of '#{cmd}'"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
```
|
15
|
+
|
6
16
|
Background:
|
7
17
|
Given I use a fixture named "cli-app"
|
8
18
|
|
@@ -5,6 +5,16 @@ Feature: before_cmd hooks
|
|
5
5
|
|
6
6
|
The command will be passed to the block.
|
7
7
|
|
8
|
+
You can hook into Aruba's lifecycle just before it runs a command and after it has run the command:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
Aruba.configure do |config|
|
12
|
+
config.before :command do |cmd|
|
13
|
+
puts "About to run '#{cmd}'"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
```
|
17
|
+
|
8
18
|
Background:
|
9
19
|
Given I use a fixture named "cli-app"
|
10
20
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Support for JRuby
|
2
|
+
|
3
|
+
Improve startup time by disabling JIT and forcing client JVM mode. This can
|
4
|
+
be accomplished by adding
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
require 'aruba/jruby'
|
8
|
+
```
|
9
|
+
|
10
|
+
*Note* - no conflict resolution on the JAVA/JRuby environment options is
|
11
|
+
done; only merging. For more complex settings please manually set the
|
12
|
+
environment variables in the hook or externally.
|
13
|
+
|
14
|
+
Refer to http://blog.headius.com/2010/03/jruby-startup-time-tips.html for other tips on startup time.
|
File without changes
|
@@ -34,6 +34,17 @@ Feature: Run commands in ruby process
|
|
34
34
|
and not during "loadtime", when the `ruby`-interpreter reads in you class
|
35
35
|
files.
|
36
36
|
|
37
|
+
*Pros*:
|
38
|
+
* Very fast compared to spawning processes
|
39
|
+
* You can use libraries like
|
40
|
+
[simplecov](https://github.com/colszowka/simplecov) more easily, because
|
41
|
+
there is only one "process" which adds data to `simplecov`'s database
|
42
|
+
|
43
|
+
*Cons*:
|
44
|
+
* You might oversee some bugs: You might forget to require libraries in your
|
45
|
+
"production" code, because you have required them in your testing code
|
46
|
+
* Using `:in_process` interactively is not supported
|
47
|
+
|
37
48
|
**WARNING**: Using `:in_process` interactively is not supported
|
38
49
|
|
39
50
|
Background:
|
@@ -444,3 +444,145 @@ Feature: All output of commands which were executed
|
|
444
444
|
"""
|
445
445
|
When I run `cucumber`
|
446
446
|
Then the features should all pass
|
447
|
+
|
448
|
+
Scenario: Handle little output
|
449
|
+
Given an executable named "bin/cli" with:
|
450
|
+
"""bash
|
451
|
+
#!/usr/bin/env bash
|
452
|
+
|
453
|
+
for ((c=0; c<256; c = c+1)); do
|
454
|
+
echo -n "a"
|
455
|
+
done
|
456
|
+
"""
|
457
|
+
And a file named "features/flushing.feature" with:
|
458
|
+
"""cucumber
|
459
|
+
Feature: Flushing output
|
460
|
+
Scenario: Run command
|
461
|
+
When I run `cli`
|
462
|
+
Then the output should contain "a"
|
463
|
+
And the output should be 256 bytes long
|
464
|
+
And the exit status should be 0
|
465
|
+
"""
|
466
|
+
When I run `cucumber`
|
467
|
+
Then the features should all pass
|
468
|
+
|
469
|
+
Scenario: Handle tons of output
|
470
|
+
|
471
|
+
In order to test processes that output a lot of data
|
472
|
+
As a developer using Aruba
|
473
|
+
I want to make sure that large amounts of output aren't buffered
|
474
|
+
|
475
|
+
Given the default aruba exit timeout is 10 seconds
|
476
|
+
And an executable named "bin/cli" with:
|
477
|
+
"""bash
|
478
|
+
#!/usr/bin/env bash
|
479
|
+
|
480
|
+
for ((c=0; c<65536; c = c+1)); do
|
481
|
+
echo -n "a"
|
482
|
+
done
|
483
|
+
"""
|
484
|
+
And a file named "features/flushing.feature" with:
|
485
|
+
"""cucumber
|
486
|
+
Feature: Flushing output
|
487
|
+
Scenario: Run command
|
488
|
+
When I run `cli`
|
489
|
+
Then the output should contain "a"
|
490
|
+
And the output should be 65536 bytes long
|
491
|
+
And the exit status should be 0
|
492
|
+
"""
|
493
|
+
When I run `cucumber`
|
494
|
+
Then the features should all pass
|
495
|
+
|
496
|
+
Scenario: Handle tons of interactive output
|
497
|
+
Given the default aruba exit timeout is 10 seconds
|
498
|
+
And an executable named "bin/cli" with:
|
499
|
+
"""bash
|
500
|
+
#!/usr/bin/env bash
|
501
|
+
|
502
|
+
read size; for ((c=0; c<$size; c = c+1)); do
|
503
|
+
echo -n "a"
|
504
|
+
done
|
505
|
+
"""
|
506
|
+
And a file named "features/flushing.feature" with:
|
507
|
+
"""cucumber
|
508
|
+
Feature: Flushing output
|
509
|
+
Scenario: Run command
|
510
|
+
When I run `cli` interactively
|
511
|
+
And I type "65536"
|
512
|
+
Then the output should contain "a"
|
513
|
+
And the output should be 65536 bytes long
|
514
|
+
And the exit status should be 0
|
515
|
+
"""
|
516
|
+
When I run `cucumber`
|
517
|
+
Then the features should all pass
|
518
|
+
|
519
|
+
@requires-aruba-version-1
|
520
|
+
Scenario: Detect output from all processes normal and interactive ones
|
521
|
+
Given an executable named "bin/cli1" with:
|
522
|
+
"""
|
523
|
+
#!/usr/bin/env bash
|
524
|
+
echo 'This is cli1'
|
525
|
+
"""
|
526
|
+
And an executable named "bin/cli2" with:
|
527
|
+
"""
|
528
|
+
#!/usr/bin/env ruby
|
529
|
+
|
530
|
+
while input = gets do
|
531
|
+
break if "" == input
|
532
|
+
puts input
|
533
|
+
end
|
534
|
+
"""
|
535
|
+
And a file named "features/output.feature" with:
|
536
|
+
"""
|
537
|
+
Feature: Run command
|
538
|
+
Scenario: Run command
|
539
|
+
When I run `cli1`
|
540
|
+
When I run `cli2` interactively
|
541
|
+
And I type "This is cli2"
|
542
|
+
And I type ""
|
543
|
+
Then the stdout should contain exactly:
|
544
|
+
\"\"\"
|
545
|
+
This is cli1
|
546
|
+
\"\"\"
|
547
|
+
And the stdout should contain exactly:
|
548
|
+
\"\"\"
|
549
|
+
This is cli2
|
550
|
+
\"\"\"
|
551
|
+
"""
|
552
|
+
When I run `cucumber`
|
553
|
+
Then the features should all pass
|
554
|
+
|
555
|
+
Scenario: Detect output from named source
|
556
|
+
Given a file named "features/output.feature" with:
|
557
|
+
"""
|
558
|
+
Feature: Run command
|
559
|
+
Scenario: Run command
|
560
|
+
When I run `printf 'simple'`
|
561
|
+
And I run `cat` interactively
|
562
|
+
And I type "interactive"
|
563
|
+
And I type ""
|
564
|
+
Then the output from "printf 'simple'" should contain "simple"
|
565
|
+
And the output from "printf 'simple'" should contain exactly "simple"
|
566
|
+
And the output from "printf 'simple'" should contain exactly:
|
567
|
+
\"\"\"
|
568
|
+
simple
|
569
|
+
\"\"\"
|
570
|
+
And the output from "cat" should not contain "simple"
|
571
|
+
"""
|
572
|
+
When I run `cucumber`
|
573
|
+
Then the features should all pass
|
574
|
+
|
575
|
+
Scenario: Detect second output from named source with custom name
|
576
|
+
Given a file named "features/output.feature" with:
|
577
|
+
"""
|
578
|
+
Feature: Run command
|
579
|
+
Scenario: Run command
|
580
|
+
When I set the environment variable "ARUBA_TEST_VAR" to "first"
|
581
|
+
And I run `bash -c 'printf $ARUBA_TEST_VAR'`
|
582
|
+
Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "first"
|
583
|
+
When I set the environment variable "ARUBA_TEST_VAR" to "second"
|
584
|
+
And I run `bash -c 'printf $ARUBA_TEST_VAR'`
|
585
|
+
Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "second"
|
586
|
+
"""
|
587
|
+
When I run `cucumber`
|
588
|
+
Then the features should all pass
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Feature: STDERR 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 stderr should contain" step
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use a fixture named "cli-app"
|
9
|
+
|
10
|
+
Scenario: Detect stderr from all processes
|
11
|
+
Given a file named "features/output.feature" with:
|
12
|
+
"""
|
13
|
+
Feature: Run command
|
14
|
+
Scenario: Run command
|
15
|
+
When I run `bash -c 'printf "hello world!\n" >&2'`
|
16
|
+
And I run `bash -c 'cat >&2 '` interactively
|
17
|
+
And I type "hola"
|
18
|
+
And I type ""
|
19
|
+
Then the stderr should contain:
|
20
|
+
\"\"\"
|
21
|
+
hello world!
|
22
|
+
\"\"\"
|
23
|
+
And the stderr should contain:
|
24
|
+
\"\"\"
|
25
|
+
hola
|
26
|
+
\"\"\"
|
27
|
+
And the stdout should not contain anything
|
28
|
+
"""
|
29
|
+
When I run `cucumber`
|
30
|
+
Then the features should all pass
|
31
|
+
|
32
|
+
Scenario: Detect stderr from all processes (deprecated)
|
33
|
+
Given a file named "features/output.feature" with:
|
34
|
+
"""
|
35
|
+
Feature: Run command
|
36
|
+
Scenario: Run command
|
37
|
+
When I run `bash -c 'printf "hello world!\n" >&2'`
|
38
|
+
And I run `bash -c 'cat >&2 '` interactively
|
39
|
+
And I type "hola"
|
40
|
+
And I type ""
|
41
|
+
Then the stderr should contain:
|
42
|
+
\"\"\"
|
43
|
+
hello world!
|
44
|
+
hola
|
45
|
+
\"\"\"
|
46
|
+
And the stdout should not contain anything
|
47
|
+
"""
|
48
|
+
When I run `cucumber`
|
49
|
+
Then the features should all pass
|
50
|
+
|
51
|
+
Scenario: Detect stderr from named source
|
52
|
+
Given a file named "features/output.feature" with:
|
53
|
+
"""
|
54
|
+
Feature: Run command
|
55
|
+
Scenario: Run command
|
56
|
+
When I run `bash -c 'printf hello >&2'`
|
57
|
+
And I run `printf goodbye`
|
58
|
+
Then the stderr from "bash -c 'printf hello >&2'" should contain "hello"
|
59
|
+
And the stderr from "bash -c 'printf hello >&2'" should contain exactly "hello"
|
60
|
+
And the stderr from "bash -c 'printf hello >&2'" should contain exactly:
|
61
|
+
\"\"\"
|
62
|
+
hello
|
63
|
+
\"\"\"
|
64
|
+
And the stdout from "bash -c 'printf hello >&2'" should not contain "hello"
|
65
|
+
And the stderr from "printf goodbye" should not contain "hello"
|
66
|
+
"""
|
67
|
+
When I run `cucumber`
|
68
|
+
Then the features should all pass
|
@@ -1,8 +1,8 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: STDOUT of commands which were executed
|
2
2
|
|
3
3
|
In order to specify expected output
|
4
4
|
As a developer using Cucumber
|
5
|
-
I want to use the "the
|
5
|
+
I want to use the "the stdout should contain" step
|
6
6
|
|
7
7
|
Background:
|
8
8
|
Given I use a fixture named "cli-app"
|
@@ -64,3 +64,46 @@ Feature: Stdout of commands which were executed
|
|
64
64
|
"""
|
65
65
|
When I run `cucumber`
|
66
66
|
Then the features should all pass
|
67
|
+
|
68
|
+
Scenario: Detect stdout from all processes including interactive ones
|
69
|
+
Given a file named "features/output.feature" with:
|
70
|
+
"""
|
71
|
+
Feature: Run command
|
72
|
+
Scenario: Run command
|
73
|
+
When I run `printf "hello world!\n"`
|
74
|
+
And I run `cat` interactively
|
75
|
+
And I type "hola"
|
76
|
+
And I type ""
|
77
|
+
Then the stdout should contain:
|
78
|
+
\"\"\"
|
79
|
+
hello world!
|
80
|
+
\"\"\"
|
81
|
+
And the stdout should contain:
|
82
|
+
\"\"\"
|
83
|
+
hola
|
84
|
+
\"\"\"
|
85
|
+
And the stderr should not contain anything
|
86
|
+
"""
|
87
|
+
When I run `cucumber`
|
88
|
+
Then the features should all pass
|
89
|
+
|
90
|
+
Scenario: Detect stdout from named source
|
91
|
+
Given a file named "features/output.feature" with:
|
92
|
+
"""
|
93
|
+
Feature: Run command
|
94
|
+
Scenario: Run command
|
95
|
+
When I run `printf 'hello'`
|
96
|
+
And I run `printf 'goodbye'`
|
97
|
+
Then the stdout from "printf 'hello'" should contain "hello"
|
98
|
+
And the stdout from "printf 'hello'" should contain exactly "hello"
|
99
|
+
And the stdout from "printf 'hello'" should contain exactly:
|
100
|
+
\"\"\"
|
101
|
+
hello
|
102
|
+
\"\"\"
|
103
|
+
And the stderr from "printf 'hello'" should not contain "hello"
|
104
|
+
And the stdout from "printf 'goodbye'" should not contain "hello"
|
105
|
+
"""
|
106
|
+
When I run `cucumber`
|
107
|
+
Then the features should all pass
|
108
|
+
|
109
|
+
|
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Append content to file
|
2
|
+
|
3
|
+
You might want to append some content to a file.
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I use a fixture named "cli-app"
|
7
|
+
|
8
|
+
Scenario: Append to a existing file
|
9
|
+
Given a file named "features/non-existence.feature" with:
|
10
|
+
"""
|
11
|
+
Feature: Existence
|
12
|
+
Scenario: Existence
|
13
|
+
Given a file named "foo/bar/example.txt" with:
|
14
|
+
\"\"\"
|
15
|
+
hello world
|
16
|
+
\"\"\"
|
17
|
+
When I append to "foo/bar/example.txt" with:
|
18
|
+
\"\"\"
|
19
|
+
this was appended
|
20
|
+
\"\"\"
|
21
|
+
Then the file named "foo/bar/example.txt" should contain:
|
22
|
+
\"\"\"
|
23
|
+
hello worldthis was appended
|
24
|
+
\"\"\"
|
25
|
+
"""
|
26
|
+
When I run `cucumber`
|
27
|
+
Then the features should all pass
|
28
|
+
|
29
|
+
Scenario: Append to a non-existing file
|
30
|
+
Given a file named "features/non-existence.feature" with:
|
31
|
+
"""
|
32
|
+
Feature: Existence
|
33
|
+
Scenario: Existence
|
34
|
+
Given a file named "foo/bar/example.txt" does not exist
|
35
|
+
When I append to "foo/bar/example.txt" with:
|
36
|
+
\"\"\"
|
37
|
+
this was appended
|
38
|
+
\"\"\"
|
39
|
+
Then the file named "foo/bar/example.txt" should contain:
|
40
|
+
\"\"\"
|
41
|
+
this was appended
|
42
|
+
\"\"\"
|
43
|
+
"""
|
44
|
+
When I run `cucumber`
|
45
|
+
Then the features should all pass
|