aruba 0.11.0.pre4 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -0,0 +1,33 @@
1
+ Feature: Change working directory
2
+
3
+ You might want to change the current working directory.
4
+
5
+ Background:
6
+ Given I use a fixture named "cli-app"
7
+
8
+ Scenario: Change to an existing sub directory
9
+ Given a file named "features/non-existence.feature" with:
10
+ """
11
+ Feature: Working Directory
12
+ Scenario: Working Directory
13
+ Given a file named "foo/bar/example.txt" with:
14
+ \"\"\"
15
+ hello world
16
+ \"\"\"
17
+ When I cd to "foo/bar"
18
+ And I run `cat example.txt`
19
+ Then the output should contain "hello world"
20
+ And the file "example.txt" should exist
21
+ """
22
+ When I run `cucumber`
23
+ Then the features should all pass
24
+
25
+ Scenario: Change to an non-existing sub directory
26
+ Given a file named "features/non-existence.feature" with:
27
+ """
28
+ Feature: Working Directory
29
+ Scenario: Working Directory
30
+ When I cd to "foo/bar/non-existing"
31
+ """
32
+ When I run `cucumber`
33
+ Then the features should not pass
@@ -0,0 +1,61 @@
1
+ Feature: Check file content
2
+
3
+ Background:
4
+ Given I use a fixture named "cli-app"
5
+
6
+ Scenario: Check file contents with plain text
7
+ Given a file named "features/non-existence.feature" with:
8
+ """
9
+ Feature: Check
10
+ Scenario: Check
11
+ Given a file named "foo" with:
12
+ \"\"\"
13
+ hello world
14
+ \"\"\"
15
+ Then the file "foo" should contain "hello world"
16
+ And the file "foo" should not contain "HELLO WORLD"
17
+ """
18
+ When I run `cucumber`
19
+ Then the features should all pass
20
+
21
+ Scenario: Check file contents with regular expression
22
+ Given a file named "features/non-existence.feature" with:
23
+ """
24
+ Feature: Check
25
+ Background:
26
+ Given a file named "foo" with:
27
+ \"\"\"
28
+ hello world
29
+ \"\"\"
30
+
31
+ Scenario: Check #1
32
+ Then the file "foo" should match /hel.o world/
33
+ And the file "foo" should not match /HELLO WORLD/
34
+
35
+ Scenario: Check #2
36
+ Then the file "foo" should match %r<hel.o world>
37
+ And the file "foo" should not match %r<HELLO WORLD>
38
+ """
39
+ When I run `cucumber`
40
+ Then the features should all pass
41
+
42
+ Scenario: Check file contents with cucumber doc string
43
+ Given a file named "features/non-existence.feature" with:
44
+ """
45
+ Feature: Existence
46
+ Scenario: Existence
47
+ Given a file named "foo" with:
48
+ \"\"\"
49
+ foo
50
+ bar
51
+ baz
52
+ foobar
53
+ \"\"\"
54
+ Then the file "foo" should contain:
55
+ \"\"\"
56
+ bar
57
+ baz
58
+ \"\"\"
59
+ """
60
+ When I run `cucumber`
61
+ Then the features should all pass
@@ -0,0 +1,39 @@
1
+ Feature: Check permissions of file
2
+
3
+ Background:
4
+ Given I use a fixture named "cli-app"
5
+
6
+ Scenario: Check mode of existing file
7
+ Given a file named "features/create_file.feature" with:
8
+ """
9
+ Feature: Check
10
+ Background:
11
+ Given an empty file named "file1.txt" with mode "0644"
12
+
13
+ Scenario: Check #1
14
+ Then the file named "file1.txt" should have permissions "0644"
15
+
16
+ Scenario: Check #2
17
+ Then a file "file1.txt" should have permissions "0644"
18
+
19
+ Scenario: Check #3
20
+ Then a file "file1.txt" should not have permissions "0444"
21
+
22
+ Scenario: Check #4
23
+ Then the file "file1.txt" should not have permissions "0444"
24
+ """
25
+ When I run `cucumber`
26
+ Then the features should all pass
27
+
28
+ Scenario: Check mode of non-existing file
29
+ Given a file named "features/create_file.feature" with:
30
+ """
31
+ Feature: Check
32
+ Background:
33
+ Given a file named "file1.txt" does not exist
34
+
35
+ Scenario: Check
36
+ Then the file named "file1.txt" should have permissions "0644"
37
+ """
38
+ When I run `cucumber`
39
+ Then the features should not pass
@@ -0,0 +1,42 @@
1
+ Feature: Compare files
2
+
3
+ Background:
4
+ Given I use a fixture named "cli-app"
5
+
6
+ Scenario: Compare existing files
7
+ Given a file named "features/non-existence.feature" with:
8
+ """
9
+ Feature: Existence
10
+ Scenario: Existence
11
+ Given a file named "foo" with:
12
+ \"\"\"
13
+ hello world
14
+ \"\"\"
15
+ And a file named "bar" with:
16
+ \"\"\"
17
+ hello world
18
+ \"\"\"
19
+ And a file named "nonbar" with:
20
+ \"\"\"
21
+ hello another world
22
+ \"\"\"
23
+ Then the file "foo" should be equal to file "bar"
24
+ And the file "foo" should not be equal to file "nonbar"
25
+ """
26
+ When I run `cucumber`
27
+ Then the features should all pass
28
+
29
+ Scenario: Compare non-existing files
30
+ Given a file named "features/non-existence.feature" with:
31
+ """
32
+ Feature: Existence
33
+ Scenario: Existence
34
+ Given a file named "foo" with:
35
+ \"\"\"
36
+ hello world
37
+ \"\"\"
38
+ Then the file "foo" should be equal to file "bar"
39
+ """
40
+ When I run `cucumber`
41
+ Then the features should not pass
42
+
@@ -10,13 +10,23 @@ Feature: Create Directory
10
10
  Given a file named "features/create_directory.feature" with:
11
11
  """
12
12
  Feature: Create directory
13
- Scenario: Create directory
13
+ Background:
14
14
  Given a directory named "dir1"
15
- Given the directory "dir2"
16
- Given the directory named "dir3"
15
+
16
+ Scenario: Create directory #1
17
+ Then a directory named "dir1" should exist
18
+
19
+ Scenario: Create directory #2
20
+ Then a directory named "dir1" should exist
21
+
22
+ Scenario: Create directory #3
23
+ Then a directory named "dir1" should exist
24
+
25
+ Scenario: Create directory #4
26
+ Then a directory named "dir1" should exist
27
+
28
+ Scenario: Create directory #5
17
29
  Then a directory named "dir1" should exist
18
- And a directory named "dir2" should exist
19
- And a directory named "dir3" should exist
20
30
  """
21
31
  When I run `cucumber`
22
32
  Then the features should all pass
@@ -34,11 +34,11 @@ Feature: Create new File
34
34
  When I run `cucumber`
35
35
  Then the features should all pass
36
36
 
37
- Scenario: Change mode a long with creation of file
37
+ Scenario: Change mode a long with creation of a file with content
38
38
  Given a file named "features/create_file.feature" with:
39
39
  """
40
- Feature: Create directory
41
- Scenario: Create directory
40
+ Feature: Create file
41
+ Scenario: Create file
42
42
  Given a file named "file1.txt" with mode "0644" and with:
43
43
  \"\"\"
44
44
  Hello World
@@ -51,3 +51,26 @@ Feature: Create new File
51
51
  """
52
52
  When I run `cucumber`
53
53
  Then the features should all pass
54
+
55
+ Scenario: Change mode a long with creation of empty file
56
+ Given a file named "features/create_file.feature" with:
57
+ """
58
+ Feature: Create file
59
+ Scenario: Create file
60
+ Given an empty file named "file1.txt" with mode "0644"
61
+ Then the file named "file1.txt" should have permissions "0644"
62
+ """
63
+ When I run `cucumber`
64
+ Then the features should all pass
65
+
66
+ Scenario: Create a fixed sized file
67
+ Given a file named "features/non-existence.feature" with:
68
+ """
69
+ Feature: Create file
70
+ Scenario: Create file
71
+ Given a 1048576 byte file named "test.txt"
72
+ Then a 1048576 byte file named "test.txt" should exist
73
+ """
74
+ When I run `cucumber`
75
+ Then the features should all pass
76
+
@@ -0,0 +1,57 @@
1
+ Feature: Make sure and check a directory exists
2
+
3
+ To setup a working environment, you may want to make sure, that a
4
+ directory exist.
5
+
6
+ Background:
7
+ Given I use a fixture named "cli-app"
8
+
9
+ Scenario: Check for presence of a single directory
10
+ Given a file named "features/existence.feature" with:
11
+ """
12
+ Feature: Existence
13
+ Background:
14
+ Given an empty directory "lorem/ipsum/dolor"
15
+
16
+ Scenario: Existence #1
17
+ Then the directory "lorem/ipsum/dolor" should exist
18
+
19
+ Scenario: Existence #2
20
+ Then the directory named "lorem/ipsum/dolor" should exist
21
+
22
+ Scenario: Existence #3
23
+ Then a directory named "lorem/ipsum/dolor" should exist
24
+ """
25
+ When I run `cucumber`
26
+ Then the features should all pass
27
+
28
+ Scenario: Check for presence of a multiple directories
29
+ Given a file named "features/existence.feature" with:
30
+ """
31
+ Feature: Existence
32
+ Scenario: Existence
33
+ Given an empty directory "lorem/ipsum/dolor"
34
+ And an empty directory "lorem/ipsum/amet"
35
+ Then the following directories should exist:
36
+ | lorem/ipsum/dolor |
37
+ | lorem/ipsum/amet |
38
+ """
39
+ When I run `cucumber`
40
+ Then the features should all pass
41
+
42
+
43
+ Scenario: Check for presence of a subset of directories
44
+ Given a file named "features/existence.feature" with:
45
+ """
46
+ Feature: Existence
47
+ Scenario: Existence
48
+ Given an empty directory "lorem/ipsum/dolor"
49
+ And an empty directory "lorem/ipsum/amet"
50
+ And an empty directory "lorem/ipsum/sit"
51
+ Then the following directories should exist:
52
+ | lorem/ipsum/dolor |
53
+ | lorem/ipsum/amet |
54
+ """
55
+ When I run `cucumber`
56
+ Then the features should all pass
57
+
@@ -0,0 +1,43 @@
1
+ Feature: Make sure and check a file exists
2
+
3
+ To setup a working environment, you may want to make sure, that a
4
+ file exist or if you ran your command of a file
5
+ was deleted.
6
+
7
+ Background:
8
+ Given I use a fixture named "cli-app"
9
+
10
+ Scenario: Check for presence of a single file
11
+ Given an empty file named "lorem/ipsum/dolor"
12
+ Then a file named "lorem/ipsum/dolor" should exist
13
+
14
+ Scenario: Check for presence of a subset of files
15
+ Given a file named "features/existence.feature" with:
16
+ """
17
+ Feature: Existence
18
+ Scenario: Existence
19
+ Given an empty file named "lorem/ipsum/dolor"
20
+ And an empty file named "lorem/ipsum/sit"
21
+ And an empty file named "lorem/ipsum/amet"
22
+ Then the following files should exist:
23
+ | lorem/ipsum/dolor |
24
+ | lorem/ipsum/amet |
25
+ """
26
+ When I run `cucumber`
27
+ Then the features should all pass
28
+
29
+ Scenario: Check for presence of a single file using a regex
30
+ Given a file named "features/non-existence.feature" with:
31
+ """
32
+ Feature: Existence
33
+ Background:
34
+ Given an empty file named "lorem/ipsum/dolor"
35
+
36
+ Scenario: Existence #1
37
+ Then a file matching %r<dolor$> should exist
38
+
39
+ Scenario: Existence #2
40
+ Then a file matching %r<ipsum/dolor> should exist
41
+ """
42
+ When I run `cucumber`
43
+ Then the features should all pass
@@ -62,3 +62,25 @@ Feature: Check file content
62
62
  """
63
63
  When I run `cucumber`
64
64
  Then the features should all pass
65
+
66
+ Scenario: Use non-ASCII UTF-8 characters
67
+ Given a file named "features/file_content.feature" with:
68
+ """
69
+ Feature: File content
70
+ Scenario: file content
71
+ Given a file named "test.txt" with:
72
+ \"\"\"
73
+ フィーチャ
74
+ \"\"\"
75
+ When I run `cat test.txt`
76
+ Then the output should contain:
77
+ \"\"\"
78
+ フィーチャ
79
+ \"\"\"
80
+ And the file named "test.txt" should contain:
81
+ \"\"\"
82
+ フィーチャ
83
+ \"\"\"
84
+ """
85
+ When I run `cucumber`
86
+ Then the features should all pass
@@ -0,0 +1,64 @@
1
+ Feature: Use fixtures in your tests
2
+
3
+ Sometimes your tests need existing files to work - e.g binary data files you
4
+ cannot create programmatically. Since `aruba` >= 0.6.3 includes some basic
5
+ support for fixtures. All you need to do is the following:
6
+
7
+ 1. Create a `fixtures`-directory
8
+ 2. Create fixture files in this directory
9
+
10
+
11
+ Background:
12
+ Given I use a fixture named "cli-app"
13
+
14
+ Scenario: Use a fixture for your tests
15
+ Given a file named "features/fixtures.feature" with:
16
+ """
17
+ Feature: Fixture
18
+ Scenario: Fixture
19
+ Given I use a fixture named "fixtures-app"
20
+ Then a file named "test.txt" should exist
21
+ """
22
+ And a directory named "fixtures"
23
+ And an empty file named "fixtures/fixtures-app/test.txt"
24
+ When I run `cucumber`
25
+ Then the features should all pass
26
+
27
+ Scenario: Use a fixture for your tests in test/
28
+ Given a file named "features/fixtures.feature" with:
29
+ """
30
+ Feature: Fixture
31
+ Scenario: Fixture
32
+ Given I use a fixture named "fixtures-app"
33
+ Then a file named "test.txt" should exist
34
+ """
35
+ And a directory named "test/fixtures"
36
+ And an empty file named "test/fixtures/fixtures-app/test.txt"
37
+ When I run `cucumber`
38
+ Then the features should all pass
39
+
40
+ Scenario: Use a fixture for your tests in specs/
41
+ Given a file named "features/fixtures.feature" with:
42
+ """
43
+ Feature: Fixture
44
+ Scenario: Fixture
45
+ Given I use a fixture named "fixtures-app"
46
+ Then a file named "test.txt" should exist
47
+ """
48
+ And a directory named "spec/fixtures"
49
+ And an empty file named "spec/fixtures/fixtures-app/test.txt"
50
+ When I run `cucumber`
51
+ Then the features should all pass
52
+
53
+ Scenario: Use a fixture for your tests in features/
54
+ Given a file named "features/fixtures.feature" with:
55
+ """
56
+ Feature: Fixture
57
+ Scenario: Fixture
58
+ Given I use a fixture named "fixtures-app"
59
+ Then a file named "test.txt" should exist
60
+ """
61
+ And a directory named "features/fixtures"
62
+ And an empty file named "features/fixtures/fixtures-app/test.txt"
63
+ When I run `cucumber`
64
+ Then the features should all pass
@@ -0,0 +1,69 @@
1
+ Feature: Make sure and check a directory does not exist
2
+
3
+ To setup a working environment, you may want to make sure, that a
4
+ directory does not exist or if you ran your command of a directory
5
+ was deleted.
6
+
7
+ Background:
8
+ Given I use a fixture named "cli-app"
9
+
10
+ Scenario: Delete existing directory
11
+ Given a file named "features/non-existence.feature" with:
12
+ """
13
+ Feature: Non-Existence
14
+ Background:
15
+ Given a directory named "example.d" does not exist
16
+
17
+ Scenario: Non-Existence #1
18
+ Then the directory "example.d" should not exist
19
+
20
+ Scenario: Non-Existence #2
21
+ Then the directory "example.d" should not exist
22
+
23
+ Scenario: Non-Existence #3
24
+ Then the directory "example.d" should not exist
25
+ """
26
+ When I run `cucumber`
27
+ Then the features should all pass
28
+
29
+ Scenario: Check if a directory does not exists
30
+ Given a file named "features/non-existence.feature" with:
31
+ """
32
+ Feature: Non-Existence
33
+ Background:
34
+ Given a directory named "example.d" does not exist
35
+
36
+ Scenario: Non-Existence #1
37
+ Then the directory "example.d" should not exist
38
+
39
+ Scenario: Non-Existence #2
40
+ Then the directory named "example.d" should not exist
41
+
42
+ Scenario: Non-Existence #3
43
+ Then a directory named "example.d" should not exist
44
+
45
+ Scenario: Non-Existence #4
46
+ Then a directory named "example.d" should not exist anymore
47
+
48
+ Scenario: Non-Existence #5
49
+ Then the directory named "example.d" should not exist anymore
50
+
51
+ Scenario: Non-Existence #6
52
+ Then the directory "example.d" should not exist anymore
53
+ """
54
+ When I run `cucumber`
55
+ Then the features should all pass
56
+
57
+ Scenario: Check for absence of a subset of directories
58
+ Given a file named "features/non-existence.feature" with:
59
+ """
60
+ Feature: Non-Existence
61
+ Scenario: Non-Existence
62
+ Given the directory "lorem/ipsum/dolor" does not exist
63
+ And the directory "lorem/ipsum/amet" does not exist
64
+ Then the following directories should not exist:
65
+ | lorem/ipsum/dolor |
66
+ | lorem/ipsum/amet |
67
+ """
68
+ When I run `cucumber`
69
+ Then the features should all pass