aruba 0.14.9 → 1.0.0

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 (309) hide show
  1. checksums.yaml +4 -4
  2. data/.cucumberproignore +3 -0
  3. data/.github/ISSUE_TEMPLATE.md +48 -0
  4. data/.github/PULL_REQUEST_TEMPLATE.md +41 -0
  5. data/.gitignore +1 -0
  6. data/.rspec +1 -1
  7. data/.rubocop.yml +20 -179
  8. data/.rubocop_todo.yml +262 -0
  9. data/.simplecov +7 -5
  10. data/.travis.yml +54 -46
  11. data/.yardopts +3 -0
  12. data/CHANGELOG.md +613 -246
  13. data/CONTRIBUTING.md +247 -45
  14. data/Dockerfile +67 -0
  15. data/Gemfile +5 -96
  16. data/LICENSE +1 -1
  17. data/README.md +57 -180
  18. data/Rakefile +63 -32
  19. data/appveyor.yml +8 -11
  20. data/aruba.gemspec +47 -41
  21. data/bin/console +7 -0
  22. data/bin/test +9 -0
  23. data/cucumber.yml +4 -24
  24. data/doc/dependency_decisions.yml +42 -2
  25. data/docker-compose.yml +26 -0
  26. data/{bin → exe}/aruba +1 -1
  27. data/fixtures/cli-app/Rakefile +1 -1
  28. data/fixtures/cli-app/bin/aruba-test-cli +6 -0
  29. data/fixtures/cli-app/cli-app.gemspec +1 -2
  30. data/fixtures/cli-app/features/support/aruba.rb +1 -0
  31. data/fixtures/cli-app/features/support/env.rb +1 -1
  32. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
  33. data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
  34. data/fixtures/cli-app/lib/cli/app.rb +1 -5
  35. data/fixtures/cli-app/spec/spec_helper.rb +4 -6
  36. data/fixtures/empty-app/Rakefile +1 -1
  37. data/fixtures/empty-app/cli-app.gemspec +1 -2
  38. data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
  39. data/fixtures/empty-app/lib/cli/app.rb +0 -6
  40. data/fixtures/getting-started-app/Gemfile +1 -1
  41. data/lib/aruba/api/commands.rb +109 -143
  42. data/lib/aruba/api/core.rb +57 -43
  43. data/lib/aruba/api/environment.rb +16 -7
  44. data/lib/aruba/api/filesystem.rb +42 -29
  45. data/lib/aruba/api/text.rb +3 -9
  46. data/lib/aruba/api.rb +6 -11
  47. data/lib/aruba/aruba_path.rb +27 -89
  48. data/lib/aruba/basic_configuration.rb +4 -24
  49. data/lib/aruba/cli.rb +1 -1
  50. data/lib/aruba/colorizer.rb +10 -99
  51. data/lib/aruba/command.rb +2 -0
  52. data/lib/aruba/config/jruby.rb +15 -5
  53. data/lib/aruba/config_wrapper.rb +1 -1
  54. data/lib/aruba/configuration.rb +92 -0
  55. data/lib/aruba/console/help.rb +1 -7
  56. data/lib/aruba/console.rb +5 -5
  57. data/lib/aruba/contracts/absolute_path.rb +2 -2
  58. data/lib/aruba/contracts/relative_path.rb +2 -2
  59. data/lib/aruba/cucumber/command.rb +171 -160
  60. data/lib/aruba/cucumber/environment.rb +1 -1
  61. data/lib/aruba/cucumber/file.rb +21 -35
  62. data/lib/aruba/cucumber/hooks.rb +17 -56
  63. data/lib/aruba/cucumber/testing_frameworks.rb +74 -50
  64. data/lib/aruba/cucumber.rb +0 -5
  65. data/lib/aruba/event_bus/name_resolver.rb +5 -16
  66. data/lib/aruba/hooks.rb +1 -1
  67. data/lib/aruba/in_config_wrapper.rb +5 -1
  68. data/lib/aruba/initializer.rb +36 -42
  69. data/lib/aruba/matchers/base/base_matcher.rb +2 -2
  70. data/lib/aruba/matchers/base/message_indenter.rb +19 -0
  71. data/lib/aruba/matchers/base/object_formatter.rb +2 -9
  72. data/lib/aruba/matchers/collection/include_an_object.rb +7 -9
  73. data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
  74. data/lib/aruba/matchers/command/have_exit_status.rb +14 -4
  75. data/lib/aruba/matchers/command/have_finished_in_time.rb +3 -5
  76. data/lib/aruba/matchers/command/have_output.rb +10 -5
  77. data/lib/aruba/matchers/command/have_output_on_stderr.rb +2 -2
  78. data/lib/aruba/matchers/command/have_output_on_stdout.rb +2 -2
  79. data/lib/aruba/matchers/command/have_output_size.rb +2 -2
  80. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +5 -7
  81. data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -6
  82. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
  83. data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
  84. data/lib/aruba/matchers/file/be_an_existing_file.rb +5 -7
  85. data/lib/aruba/matchers/file/have_file_content.rb +4 -4
  86. data/lib/aruba/matchers/file/have_file_size.rb +6 -8
  87. data/lib/aruba/matchers/file/have_same_file_content.rb +5 -8
  88. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
  89. data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
  90. data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
  91. data/lib/aruba/matchers/path/have_permissions.rb +6 -8
  92. data/lib/aruba/matchers/string/include_output_string.rb +8 -10
  93. data/lib/aruba/matchers/string/match_output_string.rb +9 -11
  94. data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
  95. data/lib/aruba/platform.rb +0 -8
  96. data/lib/aruba/platforms/announcer.rb +42 -79
  97. data/lib/aruba/platforms/aruba_file_creator.rb +2 -6
  98. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -2
  99. data/lib/aruba/platforms/aruba_logger.rb +23 -7
  100. data/lib/aruba/platforms/command_monitor.rb +12 -107
  101. data/lib/aruba/platforms/determine_disk_usage.rb +56 -14
  102. data/lib/aruba/platforms/filesystem_status.rb +10 -14
  103. data/lib/aruba/platforms/local_environment.rb +2 -2
  104. data/lib/aruba/platforms/simple_table.rb +3 -11
  105. data/lib/aruba/platforms/unix_command_string.rb +7 -11
  106. data/lib/aruba/platforms/unix_environment_variables.rb +18 -27
  107. data/lib/aruba/platforms/unix_platform.rb +20 -51
  108. data/lib/aruba/platforms/unix_which.rb +2 -1
  109. data/lib/aruba/platforms/windows_command_string.rb +15 -10
  110. data/lib/aruba/platforms/windows_environment_variables.rb +43 -44
  111. data/lib/aruba/platforms/windows_platform.rb +4 -0
  112. data/lib/aruba/platforms/windows_which.rb +4 -3
  113. data/lib/aruba/processes/basic_process.rb +28 -30
  114. data/lib/aruba/processes/debug_process.rb +12 -3
  115. data/lib/aruba/processes/in_process.rb +17 -8
  116. data/lib/aruba/processes/spawn_process.rb +57 -46
  117. data/lib/aruba/rspec.rb +14 -36
  118. data/lib/aruba/runtime.rb +3 -6
  119. data/lib/aruba/setup.rb +6 -6
  120. data/lib/aruba/tasks/docker_helpers.rb +154 -0
  121. data/lib/aruba/version.rb +1 -1
  122. metadata +191 -244
  123. data/features/.nav +0 -72
  124. data/features/api/command/find_command.feature +0 -83
  125. data/features/api/command/last_command_started.feature +0 -50
  126. data/features/api/command/last_command_stopped.feature +0 -89
  127. data/features/api/command/run.feature +0 -414
  128. data/features/api/command/run_simple.feature +0 -242
  129. data/features/api/command/send_signal.feature +0 -53
  130. data/features/api/command/stderr.feature +0 -46
  131. data/features/api/command/stdout.feature +0 -46
  132. data/features/api/command/stop.feature +0 -131
  133. data/features/api/command/stop_all_commands.feature +0 -53
  134. data/features/api/command/terminate_all_commands.feature +0 -53
  135. data/features/api/command/which.feature +0 -37
  136. data/features/api/core/expand_path.feature +0 -88
  137. data/features/api/environment/append_environment_variable.feature +0 -128
  138. data/features/api/environment/delete_environment_variable.feature +0 -63
  139. data/features/api/environment/prepend_environment_variable.feature +0 -128
  140. data/features/api/environment/set_environment_variable.feature +0 -376
  141. data/features/api/filesystem/cd.feature +0 -184
  142. data/features/api/filesystem/create_directory.feature +0 -57
  143. data/features/api/filesystem/disk_usage.feature +0 -152
  144. data/features/api/filesystem/does_exist.feature +0 -62
  145. data/features/api/filesystem/fixtures.feature +0 -104
  146. data/features/api/filesystem/is_absolute.feature +0 -48
  147. data/features/api/filesystem/is_directory.feature +0 -53
  148. data/features/api/filesystem/is_file.feature +0 -54
  149. data/features/api/filesystem/is_relative.feature +0 -48
  150. data/features/api/filesystem/move.feature +0 -119
  151. data/features/api/text/extract_text.feature +0 -87
  152. data/features/api/text/replace_variables.feature +0 -45
  153. data/features/api/text/sanitize_text.feature +0 -228
  154. data/features/api/text/unescape_text.feature +0 -127
  155. data/features/cli/console.feature +0 -52
  156. data/features/cli/init.feature +0 -79
  157. data/features/configuration/activate_announcer_on_command_failure.feature +0 -38
  158. data/features/configuration/command_runtime_environment.feature +0 -129
  159. data/features/configuration/console_history_file.feature +0 -38
  160. data/features/configuration/exit_timeout.feature +0 -52
  161. data/features/configuration/fixtures_directories.feature +0 -38
  162. data/features/configuration/fixtures_path_prefix.feature +0 -23
  163. data/features/configuration/home_directory.feature +0 -80
  164. data/features/configuration/io_timeout.feature +0 -30
  165. data/features/configuration/keep_ansi.feature +0 -30
  166. data/features/configuration/log_level.feature +0 -38
  167. data/features/configuration/physical_block_size.feature +0 -53
  168. data/features/configuration/remove_ansi_escape_sequences.feature +0 -38
  169. data/features/configuration/root_directory.feature +0 -30
  170. data/features/configuration/startup_wait_time.feature +0 -48
  171. data/features/configuration/usage.feature +0 -159
  172. data/features/configuration/working_directory.feature +0 -33
  173. data/features/development/build.feature +0 -15
  174. data/features/getting_started/cleanup.feature +0 -58
  175. data/features/getting_started/run_commands.feature +0 -187
  176. data/features/getting_started/supported_testing_frameworks.feature +0 -104
  177. data/features/getting_started/writing_good_feature_tests.feature +0 -38
  178. data/features/hooks/after/command.feature +0 -46
  179. data/features/hooks/before/command.feature +0 -75
  180. data/features/matchers/collection/include_an_object.feature +0 -72
  181. data/features/matchers/directory/have_sub_directory.feature +0 -110
  182. data/features/matchers/file/be_a_command_found_in_path.feature +0 -115
  183. data/features/matchers/file/be_existing_executable.feature +0 -88
  184. data/features/matchers/file/be_existing_file.feature +0 -82
  185. data/features/matchers/file/have_file_content.feature +0 -123
  186. data/features/matchers/file/have_file_size.feature +0 -107
  187. data/features/matchers/path/be_an_absolute_path.feature +0 -74
  188. data/features/matchers/path/be_an_existing_path.feature +0 -97
  189. data/features/matchers/path/have_permissions.feature +0 -118
  190. data/features/matchers/timeouts.feature +0 -48
  191. data/features/platforms/jruby.feature +0 -14
  192. data/features/rspec/integration.feature +0 -179
  193. data/features/step_definitions/aruba_dev_steps.rb +0 -56
  194. data/features/step_definitions/hooks.rb +0 -156
  195. data/features/steps/command/debug.feature +0 -92
  196. data/features/steps/command/exit_statuses.feature +0 -136
  197. data/features/steps/command/in_process.feature +0 -485
  198. data/features/steps/command/interactive.feature +0 -90
  199. data/features/steps/command/output.feature +0 -567
  200. data/features/steps/command/run.feature +0 -66
  201. data/features/steps/command/send_signal.feature +0 -104
  202. data/features/steps/command/shell.feature +0 -155
  203. data/features/steps/command/stderr.feature +0 -68
  204. data/features/steps/command/stdout.feature +0 -109
  205. data/features/steps/command/stop.feature +0 -313
  206. data/features/steps/core/announce.feature +0 -283
  207. data/features/steps/environment/append_environment_variable.feature +0 -52
  208. data/features/steps/environment/disable_bunder.feature +0 -18
  209. data/features/steps/environment/home_variable.feature +0 -62
  210. data/features/steps/environment/prepend_environment_variable.feature +0 -52
  211. data/features/steps/environment/set_environment_variable.feature +0 -49
  212. data/features/steps/filesystem/append_to_file.feature +0 -45
  213. data/features/steps/filesystem/cd_to_directory.feature +0 -33
  214. data/features/steps/filesystem/check_file_content.feature +0 -61
  215. data/features/steps/filesystem/check_permissions_of_file.feature +0 -39
  216. data/features/steps/filesystem/compare_files.feature +0 -42
  217. data/features/steps/filesystem/copy.feature +0 -45
  218. data/features/steps/filesystem/create_directory.feature +0 -57
  219. data/features/steps/filesystem/create_file.feature +0 -76
  220. data/features/steps/filesystem/existence_of_directory.feature +0 -57
  221. data/features/steps/filesystem/existence_of_file.feature +0 -43
  222. data/features/steps/filesystem/file_content.feature +0 -86
  223. data/features/steps/filesystem/fixtures.feature +0 -64
  224. data/features/steps/filesystem/move.feature +0 -45
  225. data/features/steps/filesystem/non_existence_of_directory.feature +0 -69
  226. data/features/steps/filesystem/non_existence_of_file.feature +0 -80
  227. data/features/steps/filesystem/overwrite_file.feature +0 -72
  228. data/features/steps/filesystem/remove_directory.feature +0 -38
  229. data/features/steps/filesystem/remove_file.feature +0 -38
  230. data/features/steps/filesystem/use_fixture.feature +0 -77
  231. data/features/steps/overview.feature +0 -25
  232. data/features/support/aruba.rb +0 -7
  233. data/features/support/env.rb +0 -33
  234. data/features/support/jruby.rb +0 -5
  235. data/features/support/simplecov_setup.rb +0 -8
  236. data/fixtures/cli-app/bin/cli +0 -6
  237. data/fixtures/spawn_process/stderr.sh +0 -3
  238. data/lib/aruba/api/deprecated.rb +0 -1234
  239. data/lib/aruba/config.rb +0 -107
  240. data/lib/aruba/cucumber/core.rb +0 -5
  241. data/lib/aruba/cucumber/rvm.rb +0 -3
  242. data/lib/aruba/in_process.rb +0 -14
  243. data/lib/aruba/jruby.rb +0 -4
  244. data/lib/aruba/matchers/deprecated/file.rb +0 -17
  245. data/lib/aruba/matchers/deprecated.rb +0 -1
  246. data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
  247. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
  248. data/lib/aruba/platforms/disk_usage_calculator.rb +0 -20
  249. data/lib/aruba/reporting.rb +0 -126
  250. data/lib/aruba/spawn_process.rb +0 -11
  251. data/script/bootstrap +0 -28
  252. data/script/console +0 -16
  253. data/script/test +0 -3
  254. data/spec/aruba/api/bundler_spec.rb +0 -15
  255. data/spec/aruba/api/deprecated_spec.rb +0 -308
  256. data/spec/aruba/api/environment/restore_env_spec.rb +0 -86
  257. data/spec/aruba/api/environment/set_env_spec.rb +0 -46
  258. data/spec/aruba/api/filesystem/file_size_spec.rb +0 -28
  259. data/spec/aruba/api/runtime_spec.rb +0 -28
  260. data/spec/aruba/api_spec.rb +0 -981
  261. data/spec/aruba/aruba_path_spec.rb +0 -103
  262. data/spec/aruba/basic_configuration_spec.rb +0 -5
  263. data/spec/aruba/configuration_spec.rb +0 -5
  264. data/spec/aruba/hooks_spec.rb +0 -17
  265. data/spec/aruba/in_config_wrapper_spec.rb +0 -25
  266. data/spec/aruba/jruby_spec.rb +0 -55
  267. data/spec/aruba/matchers/command/have_output_size_spec.rb +0 -25
  268. data/spec/aruba/matchers/command_spec.rb +0 -174
  269. data/spec/aruba/matchers/deprecated_spec.rb +0 -120
  270. data/spec/aruba/matchers/directory_spec.rb +0 -57
  271. data/spec/aruba/matchers/file_spec.rb +0 -208
  272. data/spec/aruba/matchers/path_spec.rb +0 -58
  273. data/spec/aruba/platform/simple_table_spec.rb +0 -23
  274. data/spec/aruba/platform/windows_environment_variables_spec.rb +0 -500
  275. data/spec/aruba/platforms/unix_command_string_spec.rb +0 -17
  276. data/spec/aruba/platforms/windows_command_string_spec.rb +0 -22
  277. data/spec/aruba/rspec_spec.rb +0 -15
  278. data/spec/aruba/runtime_spec.rb +0 -29
  279. data/spec/aruba/spawn_process_spec.rb +0 -96
  280. data/spec/event_bus/name_resolver_spec.rb +0 -68
  281. data/spec/event_bus_spec.rb +0 -158
  282. data/spec/spec_helper.rb +0 -20
  283. data/spec/support/configs/.keep +0 -0
  284. data/spec/support/configs/aruba.rb +0 -5
  285. data/spec/support/configs/pry.rb +0 -3
  286. data/spec/support/configs/rspec.rb +0 -15
  287. data/spec/support/helpers/.keep +0 -0
  288. data/spec/support/helpers/reporting.rb +0 -44
  289. data/spec/support/matchers/.keep +0 -0
  290. data/spec/support/matchers/option.rb +0 -35
  291. data/spec/support/shared_contexts/.keep +0 -0
  292. data/spec/support/shared_contexts/aruba.rb +0 -49
  293. data/spec/support/shared_examples/.keep +0 -0
  294. data/spec/support/shared_examples/configuration.rb +0 -116
  295. data/spec/support/shared_examples/directory.rb +0 -7
  296. data/spec/support/shared_examples/file.rb +0 -7
  297. data/templates/css/console.css +0 -24
  298. data/templates/css/filesystem.css +0 -42
  299. data/templates/css/pygments-autumn.css +0 -59
  300. data/templates/files.erb +0 -14
  301. data/templates/images/LICENSE +0 -22
  302. data/templates/images/folder.png +0 -0
  303. data/templates/images/page_white.png +0 -0
  304. data/templates/images/page_white_gherkin.png +0 -0
  305. data/templates/images/page_white_ruby.png +0 -0
  306. data/templates/index.erb +0 -20
  307. data/templates/js/filesystem.js +0 -5
  308. data/templates/js/jquery-1.11.3.min.js +0 -5
  309. data/templates/main.erb +0 -34
@@ -1,68 +0,0 @@
1
- require 'aruba/event_bus/name_resolver'
2
-
3
- describe Aruba::EventBus::NameResolver do
4
- subject(:resolver) { described_class.new(default_name_space) }
5
- let(:default_name_space) { 'Events' }
6
- let(:resolved_name) { resolver.transform(original_name) }
7
-
8
- before :each do
9
- stub_const('Events::MyEvent', Class.new)
10
- stub_const('Events::MyEvent', Class.new)
11
- end
12
-
13
- describe '#transform' do
14
- context 'when name is string' do
15
- context 'when simple' do
16
- let(:original_name) { 'Events::MyEvent' }
17
- it { expect(resolved_name).to eq Events::MyEvent }
18
- end
19
-
20
- context 'when prefixed' do
21
- let(:original_name) { '::Events::MyEvent' }
22
- it { expect(resolved_name).to eq Events::MyEvent }
23
- end
24
- end
25
-
26
- context 'when name is class' do
27
- context 'when simple' do
28
- let(:original_name) { Events::MyEvent }
29
- it { expect(resolved_name).to eq Events::MyEvent }
30
- end
31
-
32
- context 'when prefixed' do
33
- let(:original_name) { ::Events::MyEvent }
34
- it { expect(resolved_name).to eq Events::MyEvent }
35
- end
36
- end
37
-
38
- context 'when name is symbol' do
39
- let(:original_name) { :my_event }
40
- it { expect(resolved_name).to eq Events::MyEvent }
41
- end
42
-
43
- context 'when namespace ...' do
44
- before :each do
45
- stub_const('MyLib::Events::MyEvent', Class.new)
46
- end
47
-
48
- context 'when is string' do
49
- let!(:default_name_space) { 'MyLib::Events' }
50
- let!(:original_name) { :my_event }
51
-
52
- it { expect(resolved_name).to eq MyLib::Events::MyEvent }
53
- end
54
-
55
- context 'when is module' do
56
- let!(:default_name_space) { MyLib::Events }
57
- let!(:original_name) { :my_event }
58
-
59
- it { expect(resolved_name).to eq MyLib::Events::MyEvent }
60
- end
61
- end
62
-
63
- context 'when invalid' do
64
- let(:original_name) { 1 }
65
- it { expect { resolved_name }.to raise_error Aruba::EventNameResolveError, /Transforming "1"/ }
66
- end
67
- end
68
- end
@@ -1,158 +0,0 @@
1
- require 'aruba/event_bus'
2
-
3
- module Events
4
- class TestEvent; end
5
- class AnotherTestEvent; end
6
- module MalformedTestEvent; end
7
- end
8
-
9
- class MyHandler
10
- def call(*); end
11
- end
12
-
13
- class MyMalformedHandler; end
14
-
15
- describe Aruba::EventBus do
16
- subject(:bus) { described_class.new(name_resolver) }
17
-
18
- let(:name_resolver) { instance_double('Events::NameResolver') }
19
-
20
- let!(:event_klass) { Events::TestEvent }
21
- let!(:event_name) { event_klass }
22
- let!(:event_instance) { Events::TestEvent.new }
23
-
24
- let!(:another_event_klass) { Events::AnotherTestEvent }
25
- let!(:another_event_name) { another_event_klass }
26
- let!(:another_event_instance) { Events::AnotherTestEvent.new }
27
-
28
- describe '#notify' do
29
- before(:each) do
30
- allow(name_resolver).to receive(:transform).with(event_name).and_return(event_klass)
31
- end
32
-
33
- context 'when subscriber to event, the block is called and get\'s an instance of the event passed as payload' do
34
- before :each do
35
- bus.register(event_klass) do |event|
36
- @received_payload = event
37
- end
38
-
39
- bus.notify event_instance
40
- end
41
-
42
- it { expect(@received_payload).to eq(event_instance) }
43
- end
44
-
45
- context 'when not subscriber to event' do
46
- before :each do
47
- @received_payload = false
48
- bus.register(event_klass) { @received_payload = true }
49
- bus.notify another_event_instance
50
- end
51
-
52
- it { expect(@received_payload).to eq(false) }
53
- end
54
-
55
- context 'when event is not an instance of event class' do
56
- let!(:event_name) { :test_event }
57
- let(:received_payload) { [] }
58
-
59
- before :each do
60
- bus.register(event_name, proc {})
61
- end
62
-
63
- it { expect { bus.notify event_klass }.to raise_error Aruba::NoEventError }
64
- end
65
- end
66
-
67
- describe '#register' do
68
- before(:each) do
69
- allow(name_resolver).to receive(:transform).with(event_name).and_return(event_klass)
70
- end
71
-
72
- context 'when valid subscriber' do
73
- context 'when multiple instances are given' do
74
- let(:received_events) { [] }
75
-
76
- before :each do
77
- bus.register(Events::TestEvent) do |event|
78
- received_events << event
79
- end
80
- bus.register(Events::TestEvent) do |event|
81
- received_events << event
82
- end
83
-
84
- bus.notify event_instance
85
- end
86
-
87
- it { expect(received_events.length).to eq 2 }
88
- it { expect(received_events).to all eq event_instance }
89
- end
90
-
91
- context 'when is string' do
92
- let!(:event_name) { event_klass.to_s }
93
- let(:received_payload) { [] }
94
-
95
- before :each do
96
- bus.register(event_klass.to_s) do |event|
97
- received_payload << event
98
- end
99
-
100
- bus.notify event_instance
101
- end
102
-
103
- it { expect(received_payload).to include event_instance }
104
- end
105
-
106
- context 'when is symbol and event is defined in the default namespace given to NameResolver.new' do
107
- let!(:event_name) { :test_event }
108
- let(:received_payload) { [] }
109
-
110
- before :each do
111
- bus.register(event_name) do |event|
112
- received_payload << event
113
- end
114
-
115
- bus.notify event_instance
116
- end
117
-
118
- it { expect(received_payload).to include event_instance }
119
- end
120
- end
121
-
122
- context 'when valid custom handler' do
123
- context 'when single event class' do
124
- before(:each) do
125
- allow(name_resolver).to receive(:transform).with(event_name).and_return(event_klass)
126
- end
127
-
128
- before :each do
129
- bus.register(event_klass, MyHandler.new)
130
- end
131
-
132
- it { expect { bus.notify event_instance }.not_to raise_error }
133
- end
134
-
135
- context 'when list of event classes' do
136
- before(:each) do
137
- allow(name_resolver).to receive(:transform).with(event_name).and_return(event_klass)
138
- allow(name_resolver).to receive(:transform).with(another_event_name).and_return(another_event_klass)
139
- end
140
-
141
- before :each do
142
- bus.register([event_klass, another_event_klass], MyHandler.new)
143
- end
144
-
145
- it { expect { bus.notify event_instance }.not_to raise_error }
146
- it { expect { bus.notify another_event_instance }.not_to raise_error }
147
- end
148
- end
149
-
150
- context 'when malformed custom handler' do
151
- it { expect { bus.register(event_klass, MyMalformedHandler.new) }.to raise_error ArgumentError }
152
- end
153
-
154
- context 'when no handler is given' do
155
- it { expect { bus.register(event_klass) }.to raise_error ArgumentError }
156
- end
157
- end
158
- end
data/spec/spec_helper.rb DELETED
@@ -1,20 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH << ::File.expand_path('../../lib', __FILE__)
4
-
5
- require 'simplecov'
6
- SimpleCov.command_name 'rspec'
7
- SimpleCov.start
8
-
9
- # Pull in all of the gems including those in the `test` group
10
- require 'bundler'
11
- Bundler.require
12
-
13
- # Loading support files
14
- if RUBY_VERSION < '1.9'
15
- Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
16
- Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
17
- else
18
- Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
19
- Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
20
- end
File without changes
@@ -1,5 +0,0 @@
1
- require 'aruba/rspec'
2
-
3
- Aruba.configure do |config|
4
- config.activate_announcer_on_command_failure = [:stderr, :stdout, :command]
5
- end
@@ -1,3 +0,0 @@
1
- # Otherwise pry doesn't find it's RC file
2
- # if ENV['HOME'] is mocked
3
- ENV['PRYRC'] = File.expand_path('~/.pryrc')
@@ -1,15 +0,0 @@
1
- require 'rspec/core'
2
- require 'aruba/api'
3
-
4
- RSpec.configure do |config|
5
- config.filter_run :focus => true
6
-
7
- config.run_all_when_everything_filtered = true
8
-
9
- config.expect_with :rspec do |c|
10
- c.syntax = :expect
11
- end
12
-
13
- config.include Aruba::Api
14
- config.before(:each) { setup_aruba }
15
- end
File without changes
@@ -1,44 +0,0 @@
1
- module SpecHelpers
2
- module Reporting
3
- # Captures the given stream and returns it:
4
- #
5
- # stream = capture(:stdout) { puts 'notice' }
6
- # stream # => "notice\n"
7
- #
8
- # stream = capture(:stderr) { warn 'error' }
9
- # stream # => "error\n"
10
- #
11
- # even for subprocesses:
12
- #
13
- # stream = capture(:stdout) { system('echo notice') }
14
- # stream # => "notice\n"
15
- #
16
- # stream = capture(:stderr) { system('echo error 1>&2') }
17
- # stream # => "error\n"
18
- def capture(stream)
19
- stream = stream.to_s
20
- captured_stream = Tempfile.new(stream)
21
-
22
- # rubocop:disable Lint/Eval
23
- stream_io = eval("$#{stream}")
24
- # rubocop:enable Lint/Eval
25
-
26
- origin_stream = stream_io.dup
27
- stream_io.reopen(captured_stream)
28
-
29
- yield
30
-
31
- stream_io.rewind
32
- return captured_stream.read
33
- ensure
34
- captured_stream.close
35
- captured_stream.unlink
36
- stream_io.reopen(origin_stream)
37
- end
38
- alias silence capture
39
- end
40
- end
41
-
42
- RSpec.configure do |config|
43
- config.include SpecHelpers::Reporting
44
- end
File without changes
@@ -1,35 +0,0 @@
1
- RSpec::Matchers.define :be_valid_option do |_|
2
- match do |actual|
3
- subject.option?(actual)
4
- end
5
-
6
- failure_message do |actual|
7
- format("expected that \"%s\" is a valid option", actual)
8
- end
9
-
10
- failure_message_when_negated do |actual|
11
- format("expected that \"%s\" is not a valid option", actual)
12
- end
13
- end
14
-
15
- RSpec::Matchers.define :have_option_value do |expected|
16
- match do |actual|
17
- @old_actual = actual
18
- @actual = if RUBY_VERSION < '1.9'
19
- subject.send(actual.to_sym)
20
- else
21
- subject.public_send(actual.to_sym)
22
- end
23
- values_match? expected, @actual
24
- end
25
-
26
- diffable
27
-
28
- failure_message do |_actual|
29
- format(%(expected that option "%s" has value "%s"), @old_actual, expected)
30
- end
31
-
32
- failure_message_when_negated do |_actual|
33
- format(%(expected that option "%s" does not have value "%s"), @old_actual, expected)
34
- end
35
- end
File without changes
@@ -1,49 +0,0 @@
1
- require 'fileutils'
2
- require 'securerandom'
3
-
4
- RSpec.shared_context 'uses aruba API' do
5
- def random_string(options = {})
6
- options[:prefix].to_s + SecureRandom.hex + options[:suffix].to_s
7
- end
8
-
9
- def create_test_files(files, data = 'a')
10
- Array(files).each do |s|
11
- next if s.to_s[0] == '%'
12
- local_path = expand_path(s)
13
-
14
- FileUtils.mkdir_p File.dirname(local_path)
15
- File.open(local_path, 'w') { |f| f << data }
16
- end
17
- end
18
-
19
- before(:each) do
20
- klass = Class.new do
21
- include Aruba::Api
22
-
23
- def set_tag(tag_name, value)
24
- self.instance_variable_set "@#{tag_name}", value
25
- end
26
- end
27
-
28
- @aruba = klass.new
29
-
30
- @file_name = "test.txt"
31
- @file_size = 256
32
- @file_path = @aruba.expand_path(@file_name)
33
- @aruba.setup_aruba
34
-
35
- raise "We must work with relative paths, everything else is dangerous" if ?/ == @aruba.aruba.current_directory[0]
36
- end
37
- end
38
-
39
- RSpec.shared_context 'needs to expand paths' do
40
- def expand_path(*args)
41
- @aruba.expand_path(*args)
42
- end
43
- end
44
-
45
- RSpec.shared_context 'needs to run with environment' do
46
- def with_environment(*args, &block)
47
- @aruba.with_environment(*args, &block)
48
- end
49
- end
File without changes
@@ -1,116 +0,0 @@
1
- RSpec.shared_examples 'a basic configuration' do
2
- subject(:config) do
3
- Class.new(described_class) do
4
- option_accessor :use_test, :contract => { Contracts::Bool => Contracts::Bool }, :default => false
5
- end.new
6
- end
7
-
8
- it { expect(config).not_to be_nil }
9
-
10
- describe '.option_reader' do
11
- let(:config_klass) { Class.new(described_class) }
12
-
13
- subject(:config) { config_klass.new }
14
-
15
- before :each do
16
- config_klass.option_reader :new_opt, :contract => { Contracts::Num => Contracts::Num }, :default => 1
17
- end
18
-
19
- context 'when value is read' do
20
- it { expect(config.new_opt).to eq 1 }
21
- end
22
-
23
- context 'when one tries to write a value' do
24
- it { expect{ config.new_opt = 1}.to raise_error NoMethodError }
25
- end
26
-
27
- context 'when block is defined' do
28
- before :each do
29
- config_klass.option_reader :new_opt2, :contract => { Contracts::Num => Contracts::Num } do |c|
30
- c.new_opt.value + 1
31
- end
32
- end
33
-
34
- it { expect(config.new_opt2).to eq 2 }
35
- end
36
-
37
- context 'when block and default value is defined' do
38
- it do
39
- expect do
40
- config_klass.option_accessor :new_opt2, :contract => { Contracts::Num => Contracts::Num }, :default => 2 do |c|
41
- c.new_opt.value + 1
42
- end
43
- end.to raise_error ArgumentError, 'Either use block or default value'
44
- end
45
- end
46
- end
47
-
48
- describe '.option_accessor' do
49
- let(:config_klass) { Class.new(described_class) }
50
-
51
- subject(:config) { config_klass.new }
52
-
53
- before :each do
54
- config_klass.option_accessor :new_opt, :contract => { Contracts::Num => Contracts::Num }, :default => 1
55
- end
56
-
57
- context 'when default is used' do
58
- it { expect(config.new_opt).to eq 1 }
59
- end
60
-
61
- context 'when is modified' do
62
- before(:each) { config.new_opt = 2 }
63
-
64
- it { expect(config.new_opt).to eq 2 }
65
- end
66
-
67
- context 'when block is defined' do
68
- before :each do
69
- config_klass.option_accessor :new_opt2, :contract => { Contracts::Num => Contracts::Num } do |c|
70
- c.new_opt.value + 1
71
- end
72
- end
73
-
74
- it { expect(config.new_opt2).to eq 2 }
75
- end
76
-
77
- context 'when block and default value is defined' do
78
- it do
79
- expect do
80
- config_klass.option_accessor :new_opt2, :contract => { Contracts::Num => Contracts::Num }, :default => 2 do |c|
81
- c.new_opt1 + 1
82
- end
83
- end.to raise_error ArgumentError, 'Either use block or default value'
84
- end
85
- end
86
- end
87
-
88
- describe 'option?' do
89
- let(:name) { :use_test }
90
-
91
- context 'when valid option' do
92
- it { expect(name).to be_valid_option }
93
- end
94
-
95
- context 'when invalid_option' do
96
- let(:name) { :blub }
97
- it { expect(name).not_to be_valid_option }
98
- end
99
- end
100
-
101
- describe 'set_if_option' do
102
- let(:name) { :use_test }
103
- let(:value) { true }
104
-
105
- context 'when valid option' do
106
- before(:each) { config.set_if_option(name, value) }
107
- it { expect(name).to have_option_value true }
108
- end
109
-
110
- context 'when invalid_option' do
111
- let(:name) { :blub }
112
-
113
- it { expect { config.set_if_option(name, value) }.not_to raise_error }
114
- end
115
- end
116
- end
@@ -1,7 +0,0 @@
1
- shared_examples 'an existing directory' do
2
- it { Array(path).each { |p| expect(File).to be_directory(p) } }
3
- end
4
-
5
- shared_examples 'a non-existing directory' do
6
- it { Array(path).each { |p| expect(File).not_to be_exist(p) } }
7
- end
@@ -1,7 +0,0 @@
1
- shared_examples 'an existing file' do
2
- it { Array(path).each { |p| expect(File).to be_file(p) } }
3
- end
4
-
5
- shared_examples 'a non-existing file' do
6
- it { Array(path).each { |p| expect(File).not_to be_exist(p) } }
7
- end
@@ -1,24 +0,0 @@
1
- .console {
2
- background-color: #000000;
3
- color: #ffffff;
4
- }
5
-
6
- .console .xterm_ef1 { /* red */
7
- color: #ff0000;
8
- }
9
-
10
- .console .xterm_ef2 { /* green */
11
- color: #00ff00;
12
- }
13
-
14
- .console .xterm_ef3 { /* yellow */
15
- color: #ffff00;
16
- }
17
-
18
- .console .xterm_ef6 { /* cyan */
19
- color: #00ffff;
20
- }
21
-
22
- .console .xterm_ef8 { /* gray */
23
- color: #888888;
24
- }
@@ -1,42 +0,0 @@
1
- .filesystem ul {
2
- background: #FFFFFF;
3
- margin: 0;
4
- padding: 0;
5
- }
6
-
7
- .filesystem li {
8
- list-style-type: none;
9
- padding-left: 20px;
10
- margin-bottom: 4px;
11
- }
12
-
13
- .filesystem li .highlight {
14
- display: block;
15
- border: 1px solid #CCCCCC;
16
- margin-top: 4px;
17
- }
18
-
19
- .filesystem li .highlight pre, pre.console {
20
- margin: 2px;
21
- padding: 2px;
22
- }
23
-
24
- .filesystem li.file {
25
- cursor: pointer;
26
- }
27
-
28
- .filesystem li.folder {
29
- background: url('../images/folder.png') no-repeat;
30
- }
31
-
32
- .filesystem li.feature {
33
- background: url('../images/page_white_gherkin.png') no-repeat;
34
- }
35
-
36
- .filesystem li.rb {
37
- background: url('../images/page_white_ruby.png') no-repeat;
38
- }
39
-
40
- .filesystem li.unknown {
41
- background: url('../images/page_white.png') no-repeat;
42
- }
@@ -1,59 +0,0 @@
1
- /* https://raw.github.com/richleland/pygments-css/master/autumn.css */
2
- .highlight .hll { background-color: #ffffcc }
3
- .highlight .c { color: #aaaaaa; font-style: italic } /* Comment */
4
- .highlight .err { color: #F00000; background-color: #F0A0A0 } /* Error */
5
- .highlight .k { color: #0000aa } /* Keyword */
6
- .highlight .cm { color: #aaaaaa; font-style: italic } /* Comment.Multiline */
7
- .highlight .cp { color: #4c8317 } /* Comment.Preproc */
8
- .highlight .c1 { color: #aaaaaa; font-style: italic } /* Comment.Single */
9
- .highlight .cs { color: #0000aa; font-style: italic } /* Comment.Special */
10
- .highlight .gd { color: #aa0000 } /* Generic.Deleted */
11
- .highlight .ge { font-style: italic } /* Generic.Emph */
12
- .highlight .gr { color: #aa0000 } /* Generic.Error */
13
- .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
14
- .highlight .gi { color: #00aa00 } /* Generic.Inserted */
15
- .highlight .go { color: #888888 } /* Generic.Output */
16
- .highlight .gp { color: #555555 } /* Generic.Prompt */
17
- .highlight .gs { font-weight: bold } /* Generic.Strong */
18
- .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
19
- .highlight .gt { color: #aa0000 } /* Generic.Traceback */
20
- .highlight .kc { color: #0000aa } /* Keyword.Constant */
21
- .highlight .kd { color: #0000aa } /* Keyword.Declaration */
22
- .highlight .kn { color: #0000aa } /* Keyword.Namespace */
23
- .highlight .kp { color: #0000aa } /* Keyword.Pseudo */
24
- .highlight .kr { color: #0000aa } /* Keyword.Reserved */
25
- .highlight .kt { color: #00aaaa } /* Keyword.Type */
26
- .highlight .m { color: #009999 } /* Literal.Number */
27
- .highlight .s { color: #aa5500 } /* Literal.String */
28
- .highlight .na { color: #1e90ff } /* Name.Attribute */
29
- .highlight .nb { color: #00aaaa } /* Name.Builtin */
30
- .highlight .nc { color: #00aa00; text-decoration: underline } /* Name.Class */
31
- .highlight .no { color: #aa0000 } /* Name.Constant */
32
- .highlight .nd { color: #888888 } /* Name.Decorator */
33
- .highlight .ni { color: #800000; font-weight: bold } /* Name.Entity */
34
- .highlight .nf { color: #00aa00 } /* Name.Function */
35
- .highlight .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */
36
- .highlight .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */
37
- .highlight .nv { color: #aa0000 } /* Name.Variable */
38
- .highlight .ow { color: #0000aa } /* Operator.Word */
39
- .highlight .w { color: #bbbbbb } /* Text.Whitespace */
40
- .highlight .mf { color: #009999 } /* Literal.Number.Float */
41
- .highlight .mh { color: #009999 } /* Literal.Number.Hex */
42
- .highlight .mi { color: #009999 } /* Literal.Number.Integer */
43
- .highlight .mo { color: #009999 } /* Literal.Number.Oct */
44
- .highlight .sb { color: #aa5500 } /* Literal.String.Backtick */
45
- .highlight .sc { color: #aa5500 } /* Literal.String.Char */
46
- .highlight .sd { color: #aa5500 } /* Literal.String.Doc */
47
- .highlight .s2 { color: #aa5500 } /* Literal.String.Double */
48
- .highlight .se { color: #aa5500 } /* Literal.String.Escape */
49
- .highlight .sh { color: #aa5500 } /* Literal.String.Heredoc */
50
- .highlight .si { color: #aa5500 } /* Literal.String.Interpol */
51
- .highlight .sx { color: #aa5500 } /* Literal.String.Other */
52
- .highlight .sr { color: #009999 } /* Literal.String.Regex */
53
- .highlight .s1 { color: #aa5500 } /* Literal.String.Single */
54
- .highlight .ss { color: #0000aa } /* Literal.String.Symbol */
55
- .highlight .bp { color: #00aaaa } /* Name.Builtin.Pseudo */
56
- .highlight .vc { color: #aa0000 } /* Name.Variable.Class */
57
- .highlight .vg { color: #aa0000 } /* Name.Variable.Global */
58
- .highlight .vi { color: #aa0000 } /* Name.Variable.Instance */
59
- .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */