aruba 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +167 -3
  4. data/.simplecov +32 -0
  5. data/.travis.yml +5 -2
  6. data/.yardopts +8 -0
  7. data/CONTRIBUTING.md +18 -8
  8. data/Gemfile +25 -0
  9. data/History.md +8 -0
  10. data/README.md +80 -18
  11. data/Rakefile +1 -1
  12. data/aruba.gemspec +6 -8
  13. data/cucumber.yml +5 -6
  14. data/features/debug.feature +15 -0
  15. data/features/file_system_commands.feature +14 -2
  16. data/features/fixtures/copy/file.txt +1 -0
  17. data/features/fixtures/fixtures-app/test.txt +1 -0
  18. data/features/fixtures/spawn_process/stderr.sh +3 -0
  19. data/features/interactive.feature +2 -2
  20. data/features/step_definitions/aruba_dev_steps.rb +1 -1
  21. data/features/support/custom_main.rb +10 -6
  22. data/features/support/env.rb +27 -2
  23. data/features/support/simplecov_setup.rb +8 -0
  24. data/lib/aruba.rb +2 -2
  25. data/lib/aruba/announcer.rb +161 -0
  26. data/lib/aruba/api.rb +490 -251
  27. data/lib/aruba/config.rb +0 -1
  28. data/lib/aruba/cucumber.rb +71 -59
  29. data/lib/aruba/cucumber/hooks.rb +18 -13
  30. data/lib/aruba/errors.rb +6 -0
  31. data/lib/aruba/in_process.rb +5 -45
  32. data/lib/aruba/matchers/command.rb +79 -0
  33. data/lib/aruba/matchers/directory.rb +59 -0
  34. data/lib/aruba/matchers/file.rb +177 -0
  35. data/lib/aruba/matchers/mode.rb +52 -0
  36. data/lib/aruba/matchers/path.rb +99 -0
  37. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +21 -1
  38. data/lib/aruba/process_monitor.rb +113 -0
  39. data/lib/aruba/processes/basic_process.rb +25 -0
  40. data/lib/aruba/processes/debug_process.rb +59 -0
  41. data/lib/aruba/processes/in_process.rb +86 -0
  42. data/lib/aruba/processes/spawn_process.rb +159 -0
  43. data/lib/aruba/reporting.rb +2 -2
  44. data/lib/aruba/rspec.rb +26 -0
  45. data/lib/aruba/spawn_process.rb +5 -104
  46. data/lib/aruba/utils.rb +21 -0
  47. data/script/bootstrap +22 -0
  48. data/script/console +17 -0
  49. data/script/test +3 -0
  50. data/spec/aruba/api_spec.rb +813 -147
  51. data/spec/aruba/hooks_spec.rb +0 -1
  52. data/spec/aruba/matchers/command_spec.rb +43 -0
  53. data/spec/aruba/matchers/directory_spec.rb +58 -0
  54. data/spec/aruba/matchers/file_spec.rb +131 -0
  55. data/spec/aruba/matchers/path_spec.rb +85 -0
  56. data/spec/aruba/spawn_process_spec.rb +46 -28
  57. data/spec/spec_helper.rb +18 -13
  58. data/{config/rubocop/include.yml → spec/support/configs/.keep} +0 -0
  59. data/spec/support/configs/rspec.rb +15 -0
  60. data/spec/support/helpers/.keep +0 -0
  61. data/spec/support/helpers/reporting.rb +44 -0
  62. data/spec/support/matchers/.keep +0 -0
  63. data/spec/support/shared_contexts/.keep +0 -0
  64. data/spec/support/shared_contexts/aruba.rb +45 -0
  65. data/spec/support/shared_examples/.keep +0 -0
  66. data/spec/support/shared_examples/directory.rb +7 -0
  67. data/spec/support/shared_examples/file.rb +7 -0
  68. data/templates/js/jquery-1.11.3.min.js +5 -0
  69. data/templates/main.erb +1 -1
  70. metadata +87 -96
  71. data/config/rubocop/exclude.yml +0 -160
  72. data/templates/js/jquery-1.6.1.min.js +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abc9ad9b84fa8e51541f65c4fd9182308fa90b4b
4
- data.tar.gz: 8c9a74b73102f29b11a0bb3fbc3652f52bd84492
3
+ metadata.gz: a0eb00c75113997b656ddaf5d3ee303313549120
4
+ data.tar.gz: 88dd5d4a54be34ef5be25b60f2150043d968f20c
5
5
  SHA512:
6
- metadata.gz: 2f3fa2197e0e1aa64baa079883c9ea70ceb38df6fe7984f5bc973b15c8c46de8990384bf3cb674bf049c4619ff3484bac8e890a2301bd51e4c7766a48309d060
7
- data.tar.gz: d063a1f78058c485fe09ecf31f66761e20104a6746e16baf2a9adce2ace692fa3c5a7d20d90b901c32399df33af78d2c1f1021efe6aa4f91803e67c1282387e3
6
+ metadata.gz: 9787def343f0714e431f40d00c39d5eecd8be1dce98dd2097c0058de838fe1c06bcf4852d39d4493d0c4e33873e5a5f67ff3e1761e411932e843416ef137af88
7
+ data.tar.gz: 5a697b03a24370d37a818262b1873f17ec3305bdef959240a4134be79d3e21c068f5d209a270b265a03093cab1ff40f569f61d63437e67db5e18599185ad97a5
data/.gitignore CHANGED
@@ -31,3 +31,6 @@ cucumber-pro.log
31
31
 
32
32
  ## Ruby versioniser
33
33
  .ruby-version
34
+
35
+ # Temp files of yar
36
+ .yardoc
data/.rubocop.yml CHANGED
@@ -1,3 +1,167 @@
1
- inherit_from:
2
- - config/rubocop/include.yml
3
- - config/rubocop/exclude.yml
1
+ AllCops:
2
+ Exclude:
3
+ - tmp/**/*
4
+ DisplayCopNames: true
5
+ # Cop supports --auto-correct.
6
+ # Configuration parameters: SupportedStyles.
7
+ Style/HashSyntax:
8
+ Enabled: false
9
+
10
+ Metrics/ModuleLength:
11
+ Exclude:
12
+ - lib/aruba/api.rb
13
+
14
+ Metrics/AbcSize:
15
+ Enabled: false
16
+
17
+ Lint/AmbiguousRegexpLiteral:
18
+ Enabled: false
19
+
20
+ # Cop supports --auto-correct.
21
+ Lint/RescueException:
22
+ Enabled: false
23
+
24
+ # Cop supports --auto-correct.
25
+ Lint/UnusedBlockArgument:
26
+ Enabled: false
27
+
28
+ # Cop supports --auto-correct.
29
+ Lint/UnusedMethodArgument:
30
+ Enabled: false
31
+
32
+ Lint/UselessAssignment:
33
+ Enabled: false
34
+
35
+ # Configuration parameters: AllowURI.
36
+ Metrics/LineLength:
37
+ Max: 169
38
+
39
+ # Configuration parameters: CountComments.
40
+ Metrics/MethodLength:
41
+ Max: 18
42
+
43
+ # Cop supports --auto-correct.
44
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
45
+ Style/AlignParameters:
46
+ Enabled: false
47
+
48
+ Style/CaseEquality:
49
+ Enabled: false
50
+
51
+ # Cop supports --auto-correct.
52
+ Style/CharacterLiteral:
53
+ Enabled: false
54
+
55
+ # Cop supports --auto-correct.
56
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
57
+ Style/ClassCheck:
58
+ Enabled: false
59
+
60
+ Style/ClassVars:
61
+ Enabled: false
62
+
63
+ # Cop supports --auto-correct.
64
+ # Configuration parameters: PreferredMethods.
65
+ Style/CollectionMethods:
66
+ Enabled: false
67
+
68
+ Style/Documentation:
69
+ Enabled: false
70
+
71
+ # Configuration parameters: MinBodyLength.
72
+ Style/GuardClause:
73
+ Enabled: false
74
+
75
+ # Configuration parameters: MaxLineLength.
76
+ Style/IfUnlessModifier:
77
+ Enabled: false
78
+
79
+ Style/Lambda:
80
+ Enabled: false
81
+
82
+ # Cop supports --auto-correct.
83
+ Style/LeadingCommentSpace:
84
+ Enabled: false
85
+
86
+ # Cop supports --auto-correct.
87
+ # Configuration parameters: PreferredDelimiters.
88
+ Style/PercentLiteralDelimiters:
89
+ Enabled: false
90
+
91
+ # Configuration parameters: SupportedStyles.
92
+ Style/RaiseArgs:
93
+ # EnforcedStyle: compact
94
+ Enabled: false
95
+
96
+ # Cop supports --auto-correct.
97
+ Style/RedundantSelf:
98
+ Enabled: false
99
+
100
+ # Configuration parameters: MaxSlashes.
101
+ Style/RegexpLiteral:
102
+ Enabled: false
103
+
104
+ # Cop supports --auto-correct.
105
+ # Configuration parameters: AllowAsExpressionSeparator.
106
+ Style/Semicolon:
107
+ Enabled: false
108
+
109
+ # Cop supports --auto-correct.
110
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
111
+ Style/SignalException:
112
+ Enabled: false
113
+
114
+ # Configuration parameters: Methods.
115
+ Style/SingleLineBlockParams:
116
+ Enabled: false
117
+
118
+ # Cop supports --auto-correct.
119
+ Style/SingleSpaceBeforeFirstArg:
120
+ Enabled: false
121
+
122
+ # Cop supports --auto-correct.
123
+ Style/SpaceAfterComma:
124
+ Enabled: false
125
+
126
+ # Cop supports --auto-correct.
127
+ Style/SpaceAfterControlKeyword:
128
+ Enabled: false
129
+
130
+ # Cop supports --auto-correct.
131
+ Style/SpaceAfterNot:
132
+ Enabled: false
133
+
134
+ # Cop supports --auto-correct.
135
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
136
+ Style/SpaceBeforeBlockBraces:
137
+ Enabled: false
138
+
139
+ # Cop supports --auto-correct.
140
+ Style/SpaceBeforeComma:
141
+ Enabled: false
142
+
143
+ # Cop supports --auto-correct.
144
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
145
+ Style/SpaceInsideBlockBraces:
146
+ Enabled: false
147
+
148
+ # Cop supports --auto-correct.
149
+ Style/SpaceInsideBrackets:
150
+ Enabled: false
151
+
152
+ # Cop supports --auto-correct.
153
+ Style/SpaceInsideParens:
154
+ Enabled: false
155
+
156
+ # Cop supports --auto-correct.
157
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
158
+ Style/StringLiterals:
159
+ Enabled: false
160
+
161
+ # Cop supports --auto-correct.
162
+ # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
163
+ Style/TrivialAccessors:
164
+ Enabled: false
165
+
166
+ Style/RaiseArgs:
167
+ Enabled: false
data/.simplecov ADDED
@@ -0,0 +1,32 @@
1
+ # Run simplecov by default
2
+ SimpleCov.start unless ENV.key? 'ARUBA_NO_COVERAGE'
3
+
4
+ SimpleCov.configure do
5
+ # ignore this file
6
+ add_filter '.simplecov'
7
+
8
+ # Rake tasks aren't tested with rspec
9
+ add_filter 'Rakefile'
10
+ add_filter 'lib/tasks'
11
+
12
+ #
13
+ # Changed Files in Git Group
14
+ # @see http://fredwu.me/post/35625566267/simplecov-test-coverage-for-changed-files-only
15
+ untracked = `git ls-files --exclude-standard --others`
16
+ unstaged = `git diff --name-only`
17
+ staged = `git diff --name-only --cached`
18
+ all = untracked + unstaged + staged
19
+ changed_filenames = all.split("\n")
20
+
21
+ add_group 'Changed' do |source_file|
22
+ changed_filenames.select do |changed_filename|
23
+ source_file.filename.end_with?(changed_filename)
24
+ end
25
+ end
26
+
27
+ add_group 'Libraries', 'lib'
28
+
29
+ # Specs are reported on to ensure that all examples are being run and all
30
+ # lets, befores, afters, etc are being used.
31
+ add_group 'Specs', 'spec'
32
+ end
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
+ sudo: false
1
2
  language: ruby
3
+ script: script/test
4
+ install: script/bootstrap --without development debug
2
5
  rvm:
3
6
  - 2.1.5
4
7
  - 2.1.4
@@ -7,8 +10,8 @@ rvm:
7
10
  - 2.1.1
8
11
  - 2.1.0
9
12
  - 2.0.0
10
- - 1.9.3
11
- - jruby-19mode
13
+ - jruby-20mode
14
+ - jruby-21mode
12
15
  - rbx
13
16
  matrix:
14
17
  allow_failures:
data/.yardopts ADDED
@@ -0,0 +1,8 @@
1
+ --output doc/yard
2
+ --exclude features/
3
+ --verbose
4
+ --markup-provider kramdown
5
+ --markup markdown
6
+ -
7
+ LICENSE
8
+ README.md
data/CONTRIBUTING.md CHANGED
@@ -25,11 +25,20 @@ This document is a guide for those maintaining Aruba, and others who would like
25
25
  bump version in a commit by itself so we can ignore when we merge your change)
26
26
  * Send us a pull request.
27
27
 
28
+ ## Bootstrap environment
29
+
30
+ To get started with `aruba`, you just need to bootstrap the environment by
31
+ running the following command.
32
+
33
+ # Bootstrap environment
34
+ script/bootstrap
35
+
28
36
  ## Running tests
29
37
 
30
- gem install bundler
31
- bundle install
32
- bundle exec rake
38
+ Make sure you bootstrap the environment first.
39
+
40
+ # Run the test suite
41
+ script/test
33
42
 
34
43
  ## Release Process
35
44
 
@@ -51,11 +60,12 @@ Now email cukes@googlegroups.com with details of the new release. Just a copy /
51
60
  To become a release manager, create a pull request adding your name to the list below, and include your Rubygems email address in the ticket. One of the existing Release managers will then add you.
52
61
 
53
62
  Current release managers:
54
- * Jarl Friis
55
- * Matt Wynne
56
- * Aslak Hellesøy
57
- * Tom Brand
63
+ * Jarl Friis ([@jarl-dk](https://github.com/jarl-dk))
64
+ * Matt Wynne ([@mattwynne](http://github.com/mattwynne))
65
+ * Aslak Hellesøy ([@aslakhellesoy](http://github.com/aslakhellesoy))
66
+ * Tom Brand ([@tom025](https://github.com/tom025))
67
+ * Dennis Günnewig ([@maxmeyer](http://github.com/maxmeyer), [@dg-rationdata](http://github.com/dg-rationdata))
58
68
 
59
69
  To grant release karma, issue the following command:
60
70
 
61
- gem owner cucumber --add <NEW OWNER RUBYGEMS EMAIL>
71
+ gem owner aruba --add <NEW OWNER RUBYGEMS EMAIL>
data/Gemfile CHANGED
@@ -1,6 +1,31 @@
1
1
  source 'https://rubygems.org'
2
+
2
3
  gemspec
3
4
 
5
+ group :development, :test do
6
+ gem 'simplecov'
7
+ end
8
+
9
+ group :debug do
10
+ gem 'pry', '~> 0.10.1 '
11
+ gem 'byebug', '~> 4.0.5'
12
+ gem 'pry-byebug', '~> 3.1.0'
13
+ gem 'pry-stack_explorer', '~> 0.4.9'
14
+ gem 'pry-doc', '~> 0.6.0'
15
+ end
16
+
17
+ group :development, :test do
18
+ gem 'bcat', '>= 0.6.1'
19
+ gem 'kramdown', '>= 0.14'
20
+ gem 'rake', '>= 0.9.2'
21
+ gem 'rspec', '>= 3.0.0'
22
+ gem 'fuubar', '>= 1.1.1'
23
+ gem 'cucumber-pro', '~> 0.0'
24
+ gem 'rubocop', '~> 0.31.0'
25
+
26
+ gem 'license_finder', '~> 2.0.4'
27
+ end
28
+
4
29
  platforms :rbx do
5
30
  gem 'rubysl', '~> 2.0'
6
31
  gem 'rubinius-developer_tools'
data/History.md CHANGED
@@ -1,4 +1,12 @@
1
1
  ## [master](https://github.com/cucumber/aruba/compare/v0.6.2...master)
2
+ * Introducing root_directory (issue #232)
3
+ * Introducing fixtures directory (issue #224)
4
+ * Make sure a file/directory does not exist + Cleanup named file/directory steps (issue #234)
5
+ * Make matcher have_permisions public and add documentation (issue #239)
6
+ * Added matcher for file content (issue #238)
7
+ * Add rspec integrator (issue #244)
8
+ * Deprecate _file/_directory in method names (issue #243)
9
+ * Improve development environment (issue #240)
2
10
 
3
11
  ## [v0.6.2](https://github.com/cucumber/aruba/compare/v0.6.1...v0.6.2)
4
12
  * Fixed minor issue #223)
data/README.md CHANGED
@@ -2,12 +2,13 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/aruba.svg)](http://badge.fury.io/rb/aruba)
3
3
  [![Dependency Status](https://gemnasium.com/cucumber/aruba.png)](https://gemnasium.com/cucumber/aruba.png)
4
4
  [![Code Climate](https://codeclimate.com/github/cucumber/aruba.png)](https://codeclimate.com/github/cucumber/aruba)
5
+ [![Join the chat at https://gitter.im/cucumber/aruba](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cucumber/aruba?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
6
 
6
- Aruba is Cucumber extension for testing command line applications written in any programming language. Features at a glance:
7
+ Aruba is Cucumber extension for testing command line applications. Features at a glance:
7
8
 
8
- * Test any command line application
9
+ * Test any command line application, implemented in any language
9
10
  * Manipulate the file system
10
- * Create great HTML documentation based on your own Cucumber scenarios
11
+ * Automatically reset state of file system between scenarios
11
12
 
12
13
  ## Usage
13
14
 
@@ -35,25 +36,23 @@ well. One might want to use it together with `rspec`.
35
36
  1. Create a directory named `spec/support`
36
37
  2. Create a file named `spec/support/aruba.rb` with:
37
38
 
39
+ ```ruby
40
+ require 'aruba/rspec'
38
41
  ```
39
- require 'aruba/api'
40
- require 'aruba/reporting'
41
42
 
42
- RSpec.configure do |config|
43
- config.include Aruba::Api
44
-
45
- config.before(:each) do
46
- restore_env
47
- clean_current_dir
48
- end
49
- end
50
- ```
51
43
  3. Add the following to your `spec/spec_helper.rb`
52
44
 
53
- ```
45
+ ```ruby
54
46
  Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
55
47
  ```
56
48
 
49
+ 4. Add a type to your specs
50
+
51
+ ```ruby
52
+ RSpec.describe 'My feature', type: :aruba do
53
+ # [...]
54
+ end
55
+ ```
57
56
 
58
57
  ## API
59
58
 
@@ -186,8 +185,8 @@ Then wire it all up in your `features/support/env.rb` file:
186
185
  require 'aruba'
187
186
  require 'aruba/in_process'
188
187
 
189
- Aruba::InProcess.main_class = MyMain
190
- Aruba.process = Aruba::InProcess
188
+ Aruba.process = Aruba::Processes::InProcess
189
+ Aruba.process.main_class = MyMain
191
190
  ```
192
191
 
193
192
  That's it! Everything will now run inside the same ruby process, making your suite
@@ -238,6 +237,69 @@ end
238
237
 
239
238
  Refer to http://blog.headius.com/2010/03/jruby-startup-time-tips.html for other tips on startup time.
240
239
 
240
+ ## Fixtures
241
+
242
+ Sometimes your tests need existing files to work - e.g binary data files you
243
+ cannot create programmatically. Since `aruba` >= 0.6.3 includes some basic
244
+ support for fixtures. All you need to do is the following:
245
+
246
+ 1. Create a `fixtures`-directory
247
+ 2. Create fixture files in this directory
248
+
249
+ The `expand_path`-helper will expand `%` to the path of your fixtures
250
+ directory:
251
+
252
+ ```ruby
253
+ expand_path('%/song.mp3')
254
+ # => /home/user/projects/my_project/fixtures/song.mp3
255
+ ```
256
+
257
+ *Example*
258
+
259
+ 1. Create fixtures directory
260
+
261
+ ```bash
262
+ cd project
263
+
264
+ mkdir -p fixtures/
265
+ # or
266
+ mkdir -p test/fixtures/
267
+ # or
268
+ mkdir -p spec/fixtures/
269
+ # or
270
+ mkdir -p features/fixtures/
271
+ ```
272
+
273
+ 2. Store `song.mp3` in `fixtures`-directory
274
+
275
+ ```bash
276
+ cp song.mp3 fixtures/
277
+ ```
278
+
279
+ 3. Add fixture to vcs-repository - e.g. `git`, `mercurial`
280
+
281
+ 4. Create test
282
+
283
+ ```ruby
284
+ RSpec.describe 'My Feature' do
285
+ describe '#read_music_file' do
286
+ context 'when the file exists' do
287
+ let(:path) { expand_path('%/song.mp3') }
288
+
289
+ before :each do
290
+ in_current_directory { FileUtils.cp path, 'file.mp3' }
291
+ end
292
+
293
+ before :each do
294
+ run 'my_command'
295
+ end
296
+
297
+ it { expect(all_stdout).to include('Rate is 128 KB') }
298
+ end
299
+ end
300
+ end
301
+ ```
302
+
241
303
  ## Reporting
242
304
 
243
305
  *Important* - you need [Pygments](http://pygments.org/) installed to use this feature.
@@ -248,7 +310,7 @@ Aruba can generate a HTML page for each scenario that contains:
248
310
  * The description from the scenario (You can use Markdown here)
249
311
  * The command(s) that were run
250
312
  * The output from those commands (in colour if the output uses ANSI escapes)
251
- * The files that were created (syntax highlighted in in colour)
313
+ * The files that were created (syntax highlighted in colour)
252
314
 
253
315
  In addition to this, it creates an `index.html` file with links to all individual report files.
254
316
  Reporting is off by default, but you can enable it by defining the `ARUBA_REPORT_DIR` environment variable, giving it the value