opal-rspec 0.5.0.beta2 → 0.5.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +23 -4
- data/CHANGELOG.md +22 -1
- data/Gemfile +10 -3
- data/README.md +142 -36
- data/Rakefile +101 -75
- data/config.ru +8 -6
- data/gemfiles/opal_master.gemfile +18 -0
- data/lib/opal/rspec.rb +6 -10
- data/lib/opal/rspec/cached_environment.rb +23 -0
- data/lib/opal/rspec/post_rack_locator.rb +20 -0
- data/lib/opal/rspec/pre_rack_locator.rb +68 -0
- data/lib/opal/rspec/rake_task.rb +97 -20
- data/lib/opal/rspec/sprockets_environment.rb +35 -0
- data/lib/opal/rspec/version.rb +1 -1
- data/opal-rspec.gemspec +9 -12
- data/opal/opal/rspec.rb +11 -8
- data/opal/opal/rspec/async.rb +1 -0
- data/opal/opal/rspec/async/async_example.rb +27 -18
- data/opal/opal/rspec/async/example_group.rb +23 -21
- data/opal/opal/rspec/async/hooks.rb +0 -36
- data/opal/opal/rspec/async/reporter.rb +9 -0
- data/opal/opal/rspec/fixes.rb +3 -10
- data/opal/opal/rspec/fixes/opal.rb +5 -0
- data/opal/opal/rspec/fixes/opal/class.rb +8 -0
- data/opal/opal/rspec/fixes/opal/compatibility.rb +228 -0
- data/opal/opal/rspec/fixes/opal/corelib.rb +3 -0
- data/opal/opal/rspec/fixes/opal/corelib/error.rb +61 -0
- data/opal/opal/rspec/fixes/opal/corelib/regexp.rb +92 -0
- data/opal/opal/rspec/fixes/opal/corelib/struct.rb +260 -0
- data/opal/opal/rspec/fixes/opal/kernel.rb +80 -0
- data/opal/opal/rspec/fixes/opal/stdlib.rb +2 -0
- data/opal/opal/rspec/fixes/opal/stdlib/pp.rb +23 -0
- data/opal/opal/rspec/fixes/opal/stdlib/set.rb +36 -0
- data/opal/opal/rspec/fixes/rspec.rb +7 -0
- data/opal/opal/rspec/fixes/{caller_filter.rb → rspec/caller_filter.rb} +0 -0
- data/opal/opal/rspec/fixes/rspec/core.rb +9 -0
- data/opal/opal/rspec/fixes/rspec/core/configuration.rb +11 -0
- data/opal/opal/rspec/fixes/{example.rb → rspec/core/example.rb} +1 -1
- data/opal/opal/rspec/fixes/rspec/core/example_group.rb +9 -0
- data/opal/opal/rspec/fixes/rspec/core/formatters.rb +6 -0
- data/opal/opal/rspec/fixes/rspec/core/formatters/backtrace_formatter.rb +20 -0
- data/opal/opal/rspec/fixes/rspec/core/formatters/console_codes.rb +11 -0
- data/opal/opal/rspec/fixes/rspec/core/formatters/deprecation_formatter.rb +20 -0
- data/opal/opal/rspec/fixes/rspec/core/formatters/generated_deprecation_message.rb +15 -0
- data/opal/opal/rspec/fixes/rspec/core/formatters/json_formatter.rb +10 -0
- data/opal/opal/rspec/fixes/rspec/core/formatters/loader.rb +38 -0
- data/opal/opal/rspec/fixes/rspec/core/metadata.rb +39 -0
- data/opal/opal/rspec/fixes/rspec/core/notifications.rb +3 -0
- data/opal/opal/rspec/fixes/rspec/core/notifications/examples_notification.rb +30 -0
- data/opal/opal/rspec/fixes/rspec/core/notifications/failed_example_notification.rb +20 -0
- data/opal/opal/rspec/fixes/rspec/core/notifications/summary_notification.rb +26 -0
- data/opal/opal/rspec/fixes/rspec/core/ordering.rb +1 -0
- data/opal/opal/rspec/fixes/rspec/core/ordering/random.rb +13 -0
- data/opal/opal/rspec/fixes/rspec/core/reporter.rb +14 -0
- data/opal/opal/rspec/fixes/rspec/core/warnings.rb +18 -0
- data/opal/opal/rspec/fixes/rspec/example_groups.rb +49 -0
- data/opal/opal/rspec/fixes/rspec/expectations.rb +2 -0
- data/opal/opal/rspec/fixes/{expectations.rb → rspec/expectations/fail_with.rb} +0 -0
- data/opal/opal/rspec/fixes/rspec/expectations/syntax.rb +25 -0
- data/opal/opal/rspec/fixes/rspec/matchers.rb +2 -0
- data/opal/opal/rspec/fixes/rspec/matchers/built_in.rb +4 -0
- data/opal/opal/rspec/fixes/rspec/matchers/built_in/all.rb +10 -0
- data/opal/opal/rspec/fixes/rspec/matchers/built_in/compound.rb +15 -0
- data/opal/opal/rspec/fixes/rspec/matchers/built_in/start_and_end_with.rb +42 -0
- data/opal/opal/rspec/fixes/rspec/matchers/built_in/yield.rb +21 -0
- data/opal/opal/rspec/fixes/{matchers.rb → rspec/matchers/pretty.rb} +0 -0
- data/opal/opal/rspec/fixes/rspec/mocks.rb +4 -0
- data/opal/opal/rspec/fixes/rspec/mocks/error_generator.rb +40 -0
- data/opal/opal/rspec/fixes/rspec/mocks/space.rb +37 -0
- data/opal/opal/rspec/fixes/rspec/mocks/test_double.rb +39 -0
- data/opal/opal/rspec/fixes/rspec/mocks/verifying_double.rb +29 -0
- data/opal/opal/rspec/fixes/rspec/support.rb +4 -0
- data/opal/opal/rspec/fixes/rspec/support/encoded_string.rb +10 -0
- data/opal/opal/rspec/fixes/rspec/support/fuzzy_matcher.rb +23 -0
- data/opal/opal/rspec/fixes/rspec/support/recursive_const_methods.rb +7 -0
- data/opal/opal/rspec/fixes/rspec/support/ruby_features.rb +8 -0
- data/opal/opal/rspec/fixes/rspec/support/warnings.rb +18 -0
- data/opal/opal/rspec/formatter/browser_formatter.rb +38 -0
- data/opal/opal/rspec/formatter/document_io.rb +27 -0
- data/opal/opal/rspec/formatter/element.rb +88 -0
- data/opal/opal/rspec/formatter/html_printer.rb +109 -0
- data/opal/opal/rspec/formatter/noop_flush_string_io.rb +9 -0
- data/opal/opal/rspec/formatter/opal_closed_tty_io.rb +27 -0
- data/opal/opal/rspec/pre_require_fixes.rb +7 -0
- data/opal/opal/rspec/requires.rb +32 -0
- data/opal/opal/rspec/runner.rb +71 -53
- data/opal/opal/rspec/spec_opts.rb.erb +28 -0
- data/opal/opal/rspec/sprockets_runner.rb.erb +5 -3
- data/spec/mri/integration/browser_spec.rb +31 -0
- data/spec/mri/integration/rack/sprockets_runner_js_errors.rb.erb +20 -0
- data/spec/mri/integration/spec_opts_spec.rb +81 -0
- data/spec/mri/unit/opal/rspec/browser_formatter_spec.rb +35 -0
- data/spec/mri/unit/opal/rspec/cached_environment_spec.rb +103 -0
- data/spec/mri/unit/opal/rspec/opal/browser_formatter_spec.rb +14 -0
- data/spec/mri/unit/opal/rspec/rack/config.ru +12 -0
- data/spec/mri/unit/opal/rspec/rake_task_spec.rb +245 -0
- data/spec/mri/unit/opal/rspec/sprockets_environment_spec.rb +94 -0
- data/spec/mri/unit/opal/rspec/temp_dir_helper.rb +19 -0
- data/spec/{after_hooks_spec.rb → opal/after_hooks_spec.rb} +0 -0
- data/spec/{around_hooks_spec.rb → opal/around_hooks_spec.rb} +46 -105
- data/spec/{async_spec.rb → opal/async_spec.rb} +0 -0
- data/spec/{before_hooks_spec.rb → opal/before_hooks_spec.rb} +0 -0
- data/spec/{example_spec.rb → opal/example_spec.rb} +0 -0
- data/spec/opal/expected_failures.txt +40 -0
- data/spec/{matchers_spec.rb → opal/matchers_spec.rb} +0 -0
- data/spec/{mock_spec.rb → opal/mock_spec.rb} +0 -0
- data/spec/{should_syntax_spec.rb → opal/should_syntax_spec.rb} +0 -0
- data/spec/{skip_pending_spec.rb → opal/skip_pending_spec.rb} +0 -0
- data/spec/{subject_spec.rb → opal/subject_spec.rb} +16 -16
- data/spec/other/color_on_by_default_spec.rb +9 -0
- data/spec/other/dummy_spec.rb +5 -0
- data/spec/other/formatter_dependency.rb +3 -0
- data/spec/other/ignored_spec.opal +5 -0
- data/spec/other/test_formatter.rb +9 -0
- data/spec/rspec/core/config.rb +5 -0
- data/spec/rspec/core/config.ru +4 -0
- data/spec/rspec/core/core_spec_loader.rb +42 -0
- data/spec/rspec/core/filter/core/async/example_group.txt +13 -0
- data/spec/rspec/core/filter/core/async/hooks.rb +12 -0
- data/spec/rspec/core/filter/core/async/memoized_helpers.txt +3 -0
- data/spec/rspec/core/filter/core/async/metadata.txt +2 -0
- data/spec/rspec/core/filter/core/bugs/filter_manager.txt +4 -0
- data/spec/rspec/core/filter/core/bugs/formatters.txt +4 -0
- data/spec/rspec/core/filter/core/bugs/memoized_helpers.rb +11 -0
- data/spec/rspec/core/filter/core/bugs/metadata.txt +5 -0
- data/spec/rspec/core/filter/core/bugs/sandbox/subject_issue_test.rb +328 -0
- data/spec/rspec/core/filter/core/bugs/warnings_deprecations.txt +3 -0
- data/spec/rspec/core/filter/core/unsupported/core.txt +5 -0
- data/spec/rspec/core/filter/core/unsupported/example.txt +7 -0
- data/spec/rspec/core/filter/core/unsupported/example_group.txt +13 -0
- data/spec/rspec/core/filter/core/unsupported/filter_manager.txt +7 -0
- data/spec/rspec/core/filter/core/unsupported/formatters.txt +27 -0
- data/spec/rspec/core/filter/core/unsupported/hooks.txt +2 -0
- data/spec/rspec/core/filter/core/unsupported/memoized_helpers.txt +6 -0
- data/spec/rspec/core/filter/core/unsupported/metadata.txt +14 -0
- data/spec/rspec/core/filter/core/unsupported/metadata_filter.txt +2 -0
- data/spec/rspec/core/filter/core/unsupported/notifications.txt +8 -0
- data/spec/rspec/core/filter/core/unsupported/world.txt +3 -0
- data/spec/rspec/core/fixes/missing_constants.rb +20 -0
- data/spec/rspec/core/fixes/opal_itself.rb +38 -0
- data/spec/rspec/core/fixes/shared_examples.rb +3 -0
- data/spec/rspec/core/opal_alternates/rspec/core/example_group_spec.rb +145 -0
- data/spec/rspec/core/opal_alternates/rspec/core/failed_example_notification_spec.rb +31 -0
- data/spec/rspec/core/opal_alternates/rspec/core/hooks_spec.rb +113 -0
- data/spec/rspec/core/opal_alternates/rspec/core/memoized_helpers_spec.rb +36 -0
- data/spec/rspec/core/opal_alternates/rspec/core/metadata_spec.rb +48 -0
- data/spec/rspec/core/require_specs.rb +25 -0
- data/spec/rspec/core/sandboxing.rb +72 -0
- data/spec/rspec/core/spec_files_exclude.txt +41 -0
- data/spec/rspec/expectations/config.rb +16 -0
- data/spec/rspec/expectations/config.ru +4 -0
- data/spec/rspec/expectations/expectation_spec_loader.rb +106 -0
- data/spec/rspec/expectations/filter/bugs/aliased_matcher.txt +2 -0
- data/spec/rspec/expectations/filter/bugs/aliases.rb +13 -0
- data/spec/rspec/expectations/filter/bugs/base_matcher.txt +2 -0
- data/spec/rspec/expectations/filter/bugs/be.rb +4 -0
- data/spec/rspec/expectations/filter/bugs/be_instance_of.rb +7 -0
- data/spec/rspec/expectations/filter/bugs/be_spec.txt +2 -0
- data/spec/rspec/expectations/filter/bugs/configuration.txt +8 -0
- data/spec/rspec/expectations/filter/bugs/contain_exactly.rb +13 -0
- data/spec/rspec/expectations/filter/bugs/define_negated_matcher.rb +9 -0
- data/spec/rspec/expectations/filter/bugs/description_generation.rb +4 -0
- data/spec/rspec/expectations/filter/bugs/dsl.txt +14 -0
- data/spec/rspec/expectations/filter/bugs/equal.txt +3 -0
- data/spec/rspec/expectations/filter/bugs/expectation_target.txt +2 -0
- data/spec/rspec/expectations/filter/bugs/expectations.txt +2 -0
- data/spec/rspec/expectations/filter/bugs/have_attributes.rb +8 -0
- data/spec/rspec/expectations/filter/bugs/include.rb +4 -0
- data/spec/rspec/expectations/filter/bugs/operators.txt +2 -0
- data/spec/rspec/expectations/filter/bugs/raise_error.txt +2 -0
- data/spec/rspec/expectations/filter/bugs/respond_to.rb +13 -0
- data/spec/rspec/expectations/filter/bugs/sandbox/undef.rb +20 -0
- data/spec/rspec/expectations/filter/unsupported/aliases.txt +5 -0
- data/spec/rspec/expectations/filter/unsupported/be.txt +2 -0
- data/spec/rspec/expectations/filter/unsupported/be_instance_of.txt +3 -0
- data/spec/rspec/expectations/filter/unsupported/change.txt +2 -0
- data/spec/rspec/expectations/filter/unsupported/configuration.txt +2 -0
- data/spec/rspec/expectations/filter/unsupported/contain_exactly.txt +2 -0
- data/spec/rspec/expectations/filter/unsupported/description_generation.txt +6 -0
- data/spec/rspec/expectations/filter/unsupported/dsl.txt +8 -0
- data/spec/rspec/expectations/filter/unsupported/eq.txt +10 -0
- data/spec/rspec/expectations/filter/unsupported/equal.txt +3 -0
- data/spec/rspec/expectations/filter/unsupported/expectation_target.txt +2 -0
- data/spec/rspec/expectations/filter/unsupported/expectations.txt +8 -0
- data/spec/rspec/expectations/filter/unsupported/has.txt +2 -0
- data/spec/rspec/expectations/filter/unsupported/include.txt +3 -0
- data/spec/rspec/expectations/filter/unsupported/match.txt +2 -0
- data/spec/rspec/expectations/filter/unsupported/matchers.txt +11 -0
- data/spec/rspec/expectations/filter/unsupported/output.txt +14 -0
- data/spec/rspec/expectations/filter/unsupported/raise_error.txt +3 -0
- data/spec/rspec/expectations/filter/unsupported/respond_to.rb +5 -0
- data/spec/rspec/expectations/filter/unsupported/syntax.txt +3 -0
- data/spec/rspec/expectations/filter/unsupported/yield.txt +2 -0
- data/spec/rspec/expectations/fixes/example_patches.rb +32 -0
- data/spec/rspec/expectations/fixes/missing_constants.rb +12 -0
- data/spec/rspec/expectations/fixes/not_compatible.rb +6 -0
- data/spec/rspec/expectations/fixes/opal_itself.rb +140 -0
- data/spec/rspec/expectations/opal_alternates/be_instance_of_spec.rb +11 -0
- data/spec/rspec/expectations/opal_alternates/dsl_spec.rb +66 -0
- data/spec/rspec/expectations/opal_alternates/expectation_target_spec.rb +21 -0
- data/spec/rspec/expectations/opal_alternates/yield_spec.rb +11 -0
- data/spec/rspec/expectations/require_specs.rb +16 -0
- data/spec/rspec/expectations/shared_examples.rb +47 -0
- data/spec/rspec/expectations/spec_files_exclude.txt +2 -0
- data/spec/rspec/expectations/spec_helper_opal.rb +13 -0
- data/spec/rspec/filter_processor.rb +77 -0
- data/spec/rspec/mocks/config.ru +4 -0
- data/spec/rspec/mocks/filter/bugs/and_call_original.txt +9 -0
- data/spec/rspec/mocks/filter/bugs/and_wrap_original.txt +2 -0
- data/spec/rspec/mocks/filter/bugs/any_instance.rb +24 -0
- data/spec/rspec/mocks/filter/bugs/argument_matchers.rb +3 -0
- data/spec/rspec/mocks/filter/bugs/configuration.txt +2 -0
- data/spec/rspec/mocks/filter/bugs/double.txt +3 -0
- data/spec/rspec/mocks/filter/bugs/expiration.txt +2 -0
- data/spec/rspec/mocks/filter/bugs/instance_method_stasher.txt +2 -0
- data/spec/rspec/mocks/filter/bugs/methods.rb +5 -0
- data/spec/rspec/mocks/filter/bugs/mocks.txt +6 -0
- data/spec/rspec/mocks/filter/bugs/mutate_const.txt +2 -0
- data/spec/rspec/mocks/filter/bugs/partial_double.rb +8 -0
- data/spec/rspec/mocks/filter/bugs/receive.txt +5 -0
- data/spec/rspec/mocks/filter/bugs/should_syntax.txt +5 -0
- data/spec/rspec/mocks/filter/bugs/space.txt +2 -0
- data/spec/rspec/mocks/filter/bugs/spy.txt +5 -0
- data/spec/rspec/mocks/filter/bugs/stub_implementation.rb +9 -0
- data/spec/rspec/mocks/filter/unsupported/and_call_original.txt +5 -0
- data/spec/rspec/mocks/filter/unsupported/and_return.txt +2 -0
- data/spec/rspec/mocks/filter/unsupported/any_instance.rb +6 -0
- data/spec/rspec/mocks/filter/unsupported/argument_matchers.rb +10 -0
- data/spec/rspec/mocks/filter/unsupported/combining_implementation_instructions.rb +9 -0
- data/spec/rspec/mocks/filter/unsupported/double.rb +16 -0
- data/spec/rspec/mocks/filter/unsupported/expected_arg_verification.txt +2 -0
- data/spec/rspec/mocks/filter/unsupported/have_received.txt +2 -0
- data/spec/rspec/mocks/filter/unsupported/instance_double_with_class_loaded.txt +8 -0
- data/spec/rspec/mocks/filter/unsupported/mocks.rb +8 -0
- data/spec/rspec/mocks/filter/unsupported/nil_expectation_warning.rb +8 -0
- data/spec/rspec/mocks/filter/unsupported/partial_double.rb +6 -0
- data/spec/rspec/mocks/filter/unsupported/receive.txt +13 -0
- data/spec/rspec/mocks/filter/unsupported/receive_message_chain.rb +4 -0
- data/spec/rspec/mocks/filter/unsupported/receive_messages.txt +2 -0
- data/spec/rspec/mocks/filter/unsupported/should_syntax.txt +1 -0
- data/spec/rspec/mocks/filter/unsupported/space.rb +7 -0
- data/spec/rspec/mocks/filter/unsupported/stub.rb +7 -0
- data/spec/rspec/mocks/fixes/doubled_classes.rb +76 -0
- data/spec/rspec/mocks/fixes/missing_constants.rb +3 -0
- data/spec/rspec/mocks/fixes/opal_itself.rb +59 -0
- data/spec/rspec/mocks/mocks_spec_loader.rb +87 -0
- data/spec/rspec/mocks/require_specs.rb +15 -0
- data/spec/rspec/mocks/spec_files_exclude.txt +11 -0
- data/spec/rspec/mocks/spec_helper_opal.rb +129 -0
- data/spec/rspec/opal_rspec_spec_loader.rb +349 -0
- data/spec/rspec/shared/opal/fixes/deprecation_helpers.rb +31 -0
- data/spec/rspec/shared/opal/fixes/rspec_helpers.rb +6 -0
- data/spec/rspec/shared/opal/progress_json_formatter.rb +29 -0
- data/spec/rspec/support/config.rb +5 -0
- data/spec/rspec/support/config.ru +4 -0
- data/spec/rspec/support/filter/bugs/recursive_const_methods.txt +3 -0
- data/spec/rspec/support/filter/bugs/sandbox/basic_object.rb +30 -0
- data/spec/rspec/support/filter/bugs/stderr_splitter_spec.txt +2 -0
- data/spec/rspec/support/filter/bugs/support.txt +2 -0
- data/spec/rspec/support/filter/unsupported/fuzzy_matcher.txt +2 -0
- data/spec/rspec/support/filter/unsupported/support.rb +7 -0
- data/spec/rspec/support/filter/unsupported/warnings.txt +6 -0
- data/spec/rspec/support/fixes/missing_constants.rb +3 -0
- data/spec/rspec/support/fixes/opal_itself.rb +13 -0
- data/spec/rspec/support/require_specs.rb +15 -0
- data/spec/rspec/support/spec_files_exclude.txt +26 -0
- data/spec/rspec/support/spec_helper.rb +27 -0
- data/spec/rspec/support/support_spec_loader.rb +34 -0
- data/util/create_requires.rb +6 -2
- data/vendor/spec_runner.js +14 -0
- metadata +255 -43
- data/opal/opal/rspec/browser_formatter.rb +0 -225
- data/opal/opal/rspec/fixes/example_groups.rb +0 -32
- data/opal/opal/rspec/fixes/formatter.rb +0 -62
- data/opal/opal/rspec/fixes/kernel.rb +0 -48
- data/opal/opal/rspec/fixes/mocks.rb +0 -13
- data/opal/opal/rspec/fixes/reporter.rb +0 -12
- data/opal/opal/rspec/text_formatter.rb +0 -88
- data/spec_mri/integration/browser_spec.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e305c2f7bb59109967cbb5289965f1768476df0b
|
4
|
+
data.tar.gz: b60ba2e8cf4f778bd45da0051a7484275e216564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddb89491fed04a63256e2cea28df2cd56a020adbd63b09325ff76f26166744695bebc0a30724a0f3570d07d5d0d96181ad2991276f9ea5ad92532f4c64504b49
|
7
|
+
data.tar.gz: 9f78bfdf6d812667149f8b978a2694c66227b1f42bdf01f1036424f476bc89fb78bdab62cc0dfc5b47d69766b75cccf7c66a74c8bac4ab78675eb5271beec3d9
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,10 +1,26 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
cache:
|
5
|
+
bundler: true
|
6
|
+
|
7
|
+
matrix:
|
8
|
+
fast_finish: true
|
9
|
+
|
10
|
+
include:
|
11
|
+
- rvm: 1.9.3
|
12
|
+
env: RUN=default
|
13
|
+
- rvm: 2.0.0
|
14
|
+
env: RUN=default
|
15
|
+
- rvm: 2.1.0
|
16
|
+
env: RUN=default
|
17
|
+
- rvm: 2.2.3
|
18
|
+
env: RUN=default
|
19
|
+
- rvm: 2.2.3
|
20
|
+
env: RUN=default RUNNER=node
|
21
|
+
- rvm: 2.2.3
|
22
|
+
env: RUN=default
|
23
|
+
gemfile: gemfiles/opal_master.gemfile
|
8
24
|
|
9
25
|
before_install:
|
10
26
|
- git submodule update --init
|
@@ -15,3 +31,6 @@ before_script:
|
|
15
31
|
|
16
32
|
notifications:
|
17
33
|
irc: "irc.freenode.org#opal"
|
34
|
+
|
35
|
+
script:
|
36
|
+
- "bundle exec rake $RUN"
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,28 @@
|
|
4
4
|
|
5
5
|
* Update to RSpec 3.1 (core is 3.1.7, expectations/support 3.1.2, mocks 3.1.3)
|
6
6
|
|
7
|
-
*
|
7
|
+
* Opal 0.9 compatibility
|
8
|
+
|
9
|
+
* A lot more aspects of RSpec should work now as 20+ Opal pull requests were completed from opal-rspec work
|
10
|
+
|
11
|
+
* Remove copy of source from opal-rspec git repo (and just rely on git submodule fetch)
|
12
|
+
|
13
|
+
* Rake task improvements:
|
14
|
+
* supports passing a test pattern (include and exclude) and FileLists besides 'spec/**/*_spec.rb
|
15
|
+
* colors, formatter, and additional requires can be supplied from the command line via the SPEC_OPTS environment variable
|
16
|
+
|
17
|
+
* Formatters:
|
18
|
+
* Fixed issues with RSpec's BaseTextFormatter and made ProgressFormatter the default when run via the Rake task
|
19
|
+
* Fix redundant messages with expectation fails
|
20
|
+
* Browser formatter now works w/ progress bar
|
21
|
+
* JSON formatter supported
|
22
|
+
|
23
|
+
* Fixed issues with constants/example group naming
|
24
|
+
|
25
|
+
* Basic nodejs runner support
|
26
|
+
|
27
|
+
* A lot more matchers enabled
|
28
|
+
|
8
29
|
|
9
30
|
## 0.4.3 (2015-06-14)
|
10
31
|
|
data/Gemfile
CHANGED
@@ -7,6 +7,13 @@ end
|
|
7
7
|
|
8
8
|
# Opal 0.9 still in development
|
9
9
|
# gem 'opal', git: 'https://github.com/opal/opal.git'
|
10
|
-
gem '
|
11
|
-
gem '
|
12
|
-
|
10
|
+
gem 'capybara-webkit', require: false
|
11
|
+
gem 'selenium-webdriver', require: false
|
12
|
+
|
13
|
+
# These need to come from our local path in order for create_requires.rb to work properly
|
14
|
+
gem 'rspec', path: 'rspec'
|
15
|
+
gem 'rspec-support', path: 'rspec-support'
|
16
|
+
gem 'rspec-core', path: 'rspec-core'
|
17
|
+
gem 'rspec-mocks', path: 'rspec-mocks'
|
18
|
+
gem 'rspec-expectations', path: 'rspec-expectations'
|
19
|
+
|
data/README.md
CHANGED
@@ -24,24 +24,92 @@ require 'opal/rspec/rake_task'
|
|
24
24
|
Opal::RSpec::RakeTask.new(:default)
|
25
25
|
```
|
26
26
|
|
27
|
-
Then, to run your specs inside phantomjs, just run the rake task:
|
27
|
+
Then, to run your specs inside phantomjs (the default runner), just run the rake task:
|
28
28
|
|
29
29
|
```
|
30
30
|
bundle exec rake
|
31
31
|
```
|
32
32
|
|
33
|
+
Enable colors in the output
|
34
|
+
|
35
|
+
```
|
36
|
+
SPEC_OPTS="--color" bundle exec rake
|
37
|
+
```
|
38
|
+
|
39
|
+
Use a different formatter
|
40
|
+
|
41
|
+
```
|
42
|
+
SPEC_OPTS="--format json" bundle exec rake
|
43
|
+
```
|
44
|
+
|
45
|
+
The following formatters have been tested:
|
46
|
+
* Default (progress)
|
47
|
+
* Documentation
|
48
|
+
* JSON
|
49
|
+
|
50
|
+
If you need to specify additional requires for a custom formatter, you can do this:
|
51
|
+
|
52
|
+
```
|
53
|
+
SPEC_OPTS="--format SomeFormatter --require some_formatter" bundle exec rake
|
54
|
+
```
|
55
|
+
|
56
|
+
You can also customize the pattern of specs used similiar to how RSpec's rake task works:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
Opal::RSpec::RakeTask.new(:default) do |server, task|
|
60
|
+
# server is an instance of Opal::Server in case you want to add to the load path, customize, etc.
|
61
|
+
task.pattern = 'spec_alternate/**/*_spec.rb' # can also supply an array of patterns
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
Excluding patterns can be setup this way:
|
66
|
+
```ruby
|
67
|
+
Opal::RSpec::RakeTask.new(:default) do |server, task|
|
68
|
+
task.exclude_pattern = 'spec_alternate/**/*_spec.rb' # can also supply an array of patterns
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
FileLists (as in Rake FileLists) can also be supplied:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
Opal::RSpec::RakeTask.new(:default) do |server, task|
|
76
|
+
task.files = FileList['spec/**/something_spec.rb]
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
PhantomJS will timeout by default after 60 seconds. If you need to lengthen the timeout value, set it like this:
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
Opal::RSpec::RakeTask.new(:default) do |server, task|
|
84
|
+
task.files = FileList['spec/**/something_spec.rb]
|
85
|
+
task.timeout = 80000 # 80 seconds, unit needs to be milliseconds
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
### Run specs in nodejs
|
90
|
+
|
91
|
+
Same options as above, you can use the RUNNER=node environment variable or use the Rake task like so:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
Opal::RSpec::RakeTask.new(:default) do |server, task|
|
95
|
+
task.runner = :node
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
NOTE: nodejs runner does not yet work with source maps or debug mode
|
100
|
+
|
33
101
|
### Run specs in a browser
|
34
102
|
|
35
103
|
`opal-rspec` can use sprockets to build and serve specs over a simple rack
|
36
|
-
server. Add the following to a `config.ru` file:
|
104
|
+
server. Add the following to a `config.ru` file (see config.ru in this GEM):
|
37
105
|
|
38
106
|
```ruby
|
39
|
-
require '
|
40
|
-
|
41
|
-
|
42
|
-
run Opal::Server.new { |s|
|
107
|
+
require 'opal/rspec'
|
108
|
+
# or use Opal::RSpec::SprocketsEnvironment.new(spec_pattern='spec/opal/**/*_spec.{rb,opal}') to customize the pattern
|
109
|
+
sprockets_env = Opal::RSpec::SprocketsEnvironment.new
|
110
|
+
run Opal::Server.new(sprockets: sprockets_env) { |s|
|
43
111
|
s.main = 'opal/rspec/sprockets_runner'
|
44
|
-
|
112
|
+
sprockets_env.add_spec_paths_to_sprockets
|
45
113
|
s.debug = false
|
46
114
|
}
|
47
115
|
```
|
@@ -114,8 +182,9 @@ end
|
|
114
182
|
Advantages:
|
115
183
|
* Assuming your subject under test (or matchers) return/use promises, the syntax is the same for sync or async specs
|
116
184
|
|
117
|
-
Limitations:
|
185
|
+
Limitations (apply to both async approaches):
|
118
186
|
* Right now, async `before(:context)` and `after(:context)` hooks cannot be async
|
187
|
+
* You cannot use an around hooks on any example where before(:each)/after(:each) hooks are async or with an async implicit subject
|
119
188
|
* `let` dependencies cannot be async, only subject
|
120
189
|
* Opal-rspec will not timeout while waiting for your async code to finish
|
121
190
|
|
@@ -125,13 +194,13 @@ This is the approach that was supported in opal-rspec <= 0.4.3 and it still work
|
|
125
194
|
|
126
195
|
```ruby
|
127
196
|
describe MyClass2 do
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
197
|
+
async 'HTTP requests should work' do
|
198
|
+
HTTP.get('/users/1.json') do |res|
|
199
|
+
async {
|
200
|
+
expect(res).to be_ok
|
201
|
+
}
|
202
|
+
end
|
203
|
+
end
|
135
204
|
end
|
136
205
|
```
|
137
206
|
|
@@ -145,42 +214,79 @@ Advantages:
|
|
145
214
|
Disadvantages:
|
146
215
|
* Requires different syntax for async specs vs. sync specs
|
147
216
|
|
148
|
-
##
|
217
|
+
## Opal load path
|
149
218
|
|
150
|
-
|
219
|
+
NOTE: Only the deepest directory specified will be added to the Opal load path.
|
151
220
|
|
152
|
-
|
221
|
+
Example 1: For the example patterns above, only 'spec_alternate' will be added.
|
153
222
|
|
154
|
-
|
155
|
-
opal cannot handle certain features of rspec. To build that file,
|
156
|
-
which is needed to run specs, use:
|
223
|
+
Example 2: Single base path
|
157
224
|
|
158
|
-
|
225
|
+
For a pattern of:
|
226
|
+
```ruby
|
227
|
+
'spec/other/**/*spec.rb'
|
228
|
+
```
|
159
229
|
|
160
|
-
|
230
|
+
'spec/other' will be added to the load path.
|
161
231
|
|
162
|
-
|
232
|
+
Example 3: Different base paths
|
163
233
|
|
164
|
-
|
234
|
+
Multiple patterns are specified that share the same parent:
|
165
235
|
|
166
|
-
|
236
|
+
For a pattern of:
|
237
|
+
```ruby
|
238
|
+
['spec/opal/**/*hooks_spec.rb', 'spec/other/**/*_spec.rb']
|
239
|
+
```
|
167
240
|
|
168
|
-
|
241
|
+
Only 'spec' will be added to the load path.
|
242
|
+
|
243
|
+
## Other Limitations/Known Issues
|
244
|
+
|
245
|
+
* Formatting
|
246
|
+
* Backtrace info on specs is buggy ([no Kernel::caller method in Opal](https://github.com/opal/opal/issues/894)), in Firefox w/ the browser runner, no backtraces show up with failed specs
|
247
|
+
* Diffs are not yet available when objects do not meet expectations (diff-lcs gem dependency has not been dealt with yet in Opal)
|
248
|
+
* Configuration
|
249
|
+
* Not all RSpec runner options are supported yet
|
250
|
+
* At some point, using node + Phantom's ability to read environment variables could be combined with a opal friendly optparse implementation to allow full options to be supplied/parsed
|
251
|
+
* Expect and should syntax are both enabled. They cannot be disabled due to bugs with the `undef` keyword in Opal 0.8. Status of changing this via config has not been tested in Opal 0.9.
|
252
|
+
* Random order does not work yet due to lack of [srand/Random support](https://github.com/opal/opal/issues/639) and RSpec's bundled Random implementation, `RSpec::Core::Backports::Random`, locks the browser/Phantom. If you specify random order, it will be ignored.
|
253
|
+
* With Opal < 0.9, you can't access the example from named subject blocks (e.g. ```subject {|e| puts "example is #{e}" }```)
|
254
|
+
* Nodejs runner
|
255
|
+
* debug mode + source map support not there yet (see source map support - https://github.com/evanw/node-source-map-support)
|
256
|
+
* currently running a lot slower than phantomjs, might need optimization
|
257
|
+
* Matchers
|
258
|
+
* predicate matchers (be_some_method_on_your_subject) do not currently work with delegate objects (Opal `DelegateClass` is incomplete)
|
259
|
+
* operator based comparison, except for `==`, won't work on Opal 0.8 due to lack of method_missing support for operators. This works correctly in Opal 0.9.
|
260
|
+
* descriptions on aliased/negated matchers won't be like normal RSpec due to several bugs: method owner not being correct (not fixed yet), blocks passed after arguments and hash (fixed in Opal 0.9)
|
261
|
+
* equal and eq matchers function largely the same right now since `==` and `equal?` in Opal are largely the same
|
262
|
+
* time based matching is not yet tested
|
263
|
+
* arity checking is not enabled by default in Opal but it can be. It's not currently enabled because it broke a lot of Opal specs. As a result, any matcher use (particularly respond_to) that depends on arity checking will not work
|
264
|
+
* splat methods and expect(...).to respond_to will be inconsistent in Opal 0.8 since several splat bugs were fixed with Opal 0.9
|
265
|
+
* Mocks
|
266
|
+
* `allow_any_instance/any_instance_of/any_instance` will not work and may cause runner to crash due to issues with redefining the `===` operator, which breaks a case statement inside `Hooks#find_hook`
|
267
|
+
* using expect/allow on `String`, `Number`, or any immutable bridged/native class, does not work since rspec-mocks uses singleton classes and those cannot be defined on immutable objects
|
268
|
+
* mocking class methods (including `::new`) is currently broken
|
269
|
+
* `class_double/class_spy` are not supported (it depends on `ClassVerifyingDouble` inheriting from `Module` to support transferring nested constants, but that doesn't work on Opal)
|
270
|
+
* `object_spy` is not supported (depends on proper initializer behavior in `ObjectVerifyingDoubleMethods`)
|
271
|
+
* verifying partial doubles do not fully work yet
|
272
|
+
* chaining and_return after do...end does not work
|
273
|
+
* duck_type argument matching is still buggy
|
274
|
+
* `and_throw` does not work on Opal 0.8 since throw/catch was not implemented until Opal 0.9
|
275
|
+
* A lot of backports/monkey patches to Opal classes/methods are done to make this work on Opal 0.8. That means some things might work in your tests that do not work without opal-rspec. You can explore the opal/opal/rspec/fixes/opal directory to see what is being changed. All of the monkey patches check to see if the feature is "broken" before they apply themselves.
|
169
276
|
|
170
|
-
|
277
|
+
## Contributing
|
171
278
|
|
172
|
-
|
279
|
+
Install required gems at required versions:
|
173
280
|
|
174
|
-
|
281
|
+
$ bundle install
|
175
282
|
|
176
|
-
|
283
|
+
opal-rspec uses a bundled copy of rspec to fix the areas where
|
284
|
+
opal cannot handle certain features of rspec. To build that file,
|
285
|
+
which is needed to run specs, use:
|
177
286
|
|
178
|
-
|
287
|
+
$ git submodule update --init
|
179
288
|
|
180
|
-
|
181
|
-
to opal itself. `app/rspec-builder.rb` is used to precompile rspec ready to be used
|
182
|
-
in `opal-rspec`. All requires from `core.rb` have been inlined as opal cannot require
|
183
|
-
dynamically at runtime.
|
289
|
+
When updating the RSpec versions, after updating the submodule revisions, you may need to use the generate_requires Rake task in order to pre-resolve RSpec's dynamic requires
|
184
290
|
|
185
291
|
## License
|
186
292
|
|
data/Rakefile
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'rspec/core/rake_task'
|
3
|
-
Bundler.require
|
4
3
|
|
5
4
|
Bundler::GemHelper.install_tasks
|
6
5
|
|
7
6
|
require 'opal/rspec/rake_task'
|
8
|
-
|
7
|
+
require_relative 'spec/rspec/core/core_spec_loader'
|
8
|
+
require_relative 'spec/rspec/expectations/expectation_spec_loader'
|
9
|
+
require_relative 'spec/rspec/support/support_spec_loader'
|
10
|
+
require_relative 'spec/rspec/mocks/mocks_spec_loader'
|
11
|
+
|
12
|
+
task :default => [:unit_specs, :verify_opal_specs, :integration_specs, :verify_rspec_specs]
|
13
|
+
|
14
|
+
desc 'Runs a set of specs in opal'
|
15
|
+
Opal::RSpec::RakeTask.new(:opal_specs) do |_, task|
|
16
|
+
task.pattern = 'spec/opal/**/*_spec.{rb,opal}'
|
17
|
+
end
|
9
18
|
|
10
19
|
desc 'Generates an RSpec requires file free of dynamic requires'
|
11
20
|
task :generate_requires do
|
@@ -13,15 +22,52 @@ task :generate_requires do
|
|
13
22
|
sh 'ruby -Irspec/lib -Irspec-core/lib/rspec -Irspec-support/lib/rspec util/create_requires.rb'
|
14
23
|
end
|
15
24
|
|
16
|
-
|
17
|
-
|
25
|
+
desc 'Runs a test to test browser based specs using Opal specs in spec/opal'
|
26
|
+
RSpec::Core::RakeTask.new :integration_specs do |t|
|
27
|
+
t.pattern = 'spec/mri/integration/**/*_spec.rb'
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Unit tests for MRI focused components of opal-rspec'
|
31
|
+
RSpec::Core::RakeTask.new :unit_specs do |t|
|
32
|
+
t.pattern = 'spec/mri/unit/**/*_spec.rb'
|
33
|
+
t.exclude_pattern = 'spec/mri/unit/opal/rspec/opal/**/*'
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'A more limited spec suite to test pattern usage'
|
37
|
+
Opal::RSpec::RakeTask.new(:other_specs) do |_, task|
|
38
|
+
task.pattern = 'spec/other/dummy_spec.rb'
|
18
39
|
end
|
19
40
|
|
20
|
-
|
41
|
+
Opal::RSpec::RakeTask.new(:color_on_by_default) do |_, task|
|
42
|
+
task.pattern = 'spec/other/color_on_by_default_spec.rb'
|
43
|
+
end
|
44
|
+
|
45
|
+
Opal::RSpec::CoreSpecLoader.rake_tasks_for(:rspec_core_specs)
|
46
|
+
Opal::RSpec::ExpectationSpecLoader.rake_tasks_for(:rspec_expectation_specs)
|
47
|
+
Opal::RSpec::SupportSpecLoader.rake_tasks_for(:rspec_support_specs)
|
48
|
+
Opal::RSpec::MocksSpecLoader.rake_tasks_for(:rspec_mocks_specs)
|
21
49
|
|
22
|
-
|
23
|
-
|
24
|
-
|
50
|
+
# These are done
|
51
|
+
desc 'Verifies all RSpec specs'
|
52
|
+
task :verify_rspec_specs => [
|
53
|
+
:verify_rspec_support_specs,
|
54
|
+
:verify_rspec_core_specs,
|
55
|
+
:verify_rspec_expectation_specs,
|
56
|
+
:verify_rspec_mocks_specs
|
57
|
+
]
|
58
|
+
|
59
|
+
desc 'Verifies other_spec_dir task ran correctly'
|
60
|
+
task :verify_other_specs do
|
61
|
+
test_output = `rake other_specs`
|
62
|
+
unless /1 example, 0 failures/.match(test_output)
|
63
|
+
raise "Expected 1 passing example, but got output '#{test_output}'"
|
64
|
+
end
|
65
|
+
puts 'Test successful'
|
66
|
+
end
|
67
|
+
|
68
|
+
desc 'Will run a spec suite (rake opal_specs) and check for expected combination of failures and successes'
|
69
|
+
task :verify_opal_specs do
|
70
|
+
test_output = `rake opal_specs`
|
25
71
|
raise "Expected test runner to fail due to failed tests, but got return code of #{$?.exitstatus}" if $?.success?
|
26
72
|
count_match = /(\d+) examples, (\d+) failures, (\d+) pending/.match(test_output)
|
27
73
|
raise 'Expected a finished count of test failures/success/etc. but did not see it' unless count_match
|
@@ -46,73 +92,9 @@ task :verify_rake_specs do
|
|
46
92
|
end
|
47
93
|
end
|
48
94
|
|
49
|
-
expected_pending_count =
|
50
|
-
|
51
|
-
|
52
|
-
'promise matcher fails properly',
|
53
|
-
'promise non-assertion failure in promise no args',
|
54
|
-
'promise non-assertion failure in promise string arg',
|
55
|
-
'promise non-assertion failure in promise exception arg',
|
56
|
-
'pending in example no promise would not fail otherwise, thus fails properly',
|
57
|
-
'async/sync mix fails properly if a sync test is among async tests',
|
58
|
-
'async/sync mix can finish running after a long delay and fail properly',
|
59
|
-
'be_truthy fails properly with truthy values',
|
60
|
-
'subject sync unnamed assertion fails properly should eq 43',
|
61
|
-
'subject sync unnamed fails properly during subject create',
|
62
|
-
'subject async assertion implicit fails properly should eq 43',
|
63
|
-
'subject async fails properly during creation explicit async',
|
64
|
-
'subject async fails properly during creation implicit usage',
|
65
|
-
'subject async assertion explicit async fails properly',
|
66
|
-
'hooks around sync fails after example should equal 42',
|
67
|
-
'hooks around sync fails before example',
|
68
|
-
'hooks around async fails after example after(:each) async fails sync match passes',
|
69
|
-
'hooks around async fails after example after(:each) async passes sync match passes',
|
70
|
-
'hooks around async fails after example after(:each) sync fails sync match passes',
|
71
|
-
'hooks around async fails after example after(:each) sync passes sync match passes',
|
72
|
-
'hooks around async fails after example before(:each) fails should not reach the example',
|
73
|
-
'hooks around async fails after example matches another async match',
|
74
|
-
'hooks around async fails after example matches async match',
|
75
|
-
'hooks around async fails after example matches async match fails properly',
|
76
|
-
'hooks around async fails after example matches sync fails properly',
|
77
|
-
'hooks around async fails after example matches sync match',
|
78
|
-
'hooks around async fails before example after(:each) async fails sync match passes',
|
79
|
-
'hooks around async fails before example after(:each) async passes sync match passes',
|
80
|
-
'hooks around async fails before example after(:each) sync fails sync match passes',
|
81
|
-
'hooks around async fails before example after(:each) sync passes sync match passes',
|
82
|
-
'hooks around async fails before example before(:each) fails should not reach the example',
|
83
|
-
'hooks around async fails before example matches another async match',
|
84
|
-
'hooks around async fails before example matches async match',
|
85
|
-
'hooks around async fails before example matches async match fails properly',
|
86
|
-
'hooks around async fails before example matches sync fails properly',
|
87
|
-
'hooks around async fails before example matches sync match',
|
88
|
-
'hooks around async succeeds after(:each) async fails sync match passes',
|
89
|
-
'hooks around async succeeds after(:each) sync fails sync match passes',
|
90
|
-
'hooks around async succeeds before(:each) fails should not reach the example',
|
91
|
-
'hooks around async succeeds matches async match fails properly',
|
92
|
-
'hooks around async succeeds matches sync fails properly',
|
93
|
-
'hooks before async with async subject async match fails properly',
|
94
|
-
'hooks before async with async subject before :each fails properly should not reach the example',
|
95
|
-
'hooks before async with async subject before :each succeeds, assertion fails properly should not eq 42',
|
96
|
-
'hooks before async with async subject before :each succeeds, subject fails properly should not reach the example',
|
97
|
-
'hooks before async with async subject both subject and before(:each) fail properly should not reach the example',
|
98
|
-
'hooks before async with sync subject async match fails properly',
|
99
|
-
'hooks before async with sync subject before :each fails properly should not reach the example',
|
100
|
-
'hooks before async with sync subject match fails properly should not eq 42',
|
101
|
-
'hooks before sync with sync subject context fails properly should not reach the example',
|
102
|
-
'hooks before sync with sync subject before :each fails properly should not reach the example',
|
103
|
-
'hooks before sync with sync subject match fails properly should not eq 42',
|
104
|
-
'hooks before sync with sync subject first before :each in chain triggers failure inner context should not reach the example',
|
105
|
-
'hooks after sync after fails should eq 42',
|
106
|
-
'hooks after sync before fails should not reach the example',
|
107
|
-
'hooks after sync match fails async match',
|
108
|
-
'hooks after sync match fails sync match should eq 43',
|
109
|
-
'hooks after async after(:each) fails properly',
|
110
|
-
'hooks after async before(:each) fails properly',
|
111
|
-
'hooks after async match fails properly async match',
|
112
|
-
'hooks after async match fails properly sync match should eq 43',
|
113
|
-
'exception handling should fail properly if an exception is raised',
|
114
|
-
'exception handling should ignore an exception after a failed assertion',
|
115
|
-
'legacy async fails properly after a long delay'].sort
|
95
|
+
expected_pending_count = 12
|
96
|
+
expected_failures = File.read('spec/opal/expected_failures.txt').split("\n").compact.sort
|
97
|
+
|
116
98
|
if actual_failures != expected_failures
|
117
99
|
unexpected = actual_failures - expected_failures
|
118
100
|
missing = expected_failures - actual_failures
|
@@ -124,7 +106,51 @@ task :verify_rake_specs do
|
|
124
106
|
|
125
107
|
if failure_messages.empty?
|
126
108
|
puts 'Test successful!'
|
109
|
+
puts "#{total} total specs, #{failed} expected failures, #{pending} expected pending"
|
127
110
|
else
|
128
111
|
raise "Test failed, reasons:\n\n#{failure_messages.join("\n")}\n"
|
129
112
|
end
|
130
113
|
end
|
114
|
+
|
115
|
+
desc "Build build/opal-rspec.js"
|
116
|
+
task :dist do
|
117
|
+
require 'fileutils'
|
118
|
+
FileUtils.mkdir_p 'build'
|
119
|
+
|
120
|
+
builder = Opal::Builder.new(stubs: Opal::Processor.stubbed_files, # stubs already specified in lib/opal/rspec.rb
|
121
|
+
compiler_options: {dynamic_require_severity: :ignore}) # RSpec is full of dynamic requires
|
122
|
+
src = builder.build('opal-rspec')
|
123
|
+
|
124
|
+
min = uglify src
|
125
|
+
gzp = gzip min
|
126
|
+
|
127
|
+
File.open('build/opal-rspec.js', 'w+') do |out|
|
128
|
+
out << src
|
129
|
+
end
|
130
|
+
|
131
|
+
puts "development: #{src.size}, minified: #{min.size}, gzipped: #{gzp.size}"
|
132
|
+
end
|
133
|
+
|
134
|
+
# Used for uglifying source to minify
|
135
|
+
def uglify(str)
|
136
|
+
IO.popen('uglifyjs', 'r+') do |i|
|
137
|
+
i.puts str
|
138
|
+
i.close_write
|
139
|
+
return i.read
|
140
|
+
end
|
141
|
+
rescue Errno::ENOENT
|
142
|
+
$stderr.puts '"uglifyjs" command not found (install with: "npm install -g uglify-js")'
|
143
|
+
nil
|
144
|
+
end
|
145
|
+
|
146
|
+
# Gzip code to check file size
|
147
|
+
def gzip(str)
|
148
|
+
IO.popen('gzip -f', 'r+') do |i|
|
149
|
+
i.puts str
|
150
|
+
i.close_write
|
151
|
+
return i.read
|
152
|
+
end
|
153
|
+
rescue Errno::ENOENT
|
154
|
+
$stderr.puts '"gzip" command not found, it is required to produce the .gz version'
|
155
|
+
nil
|
156
|
+
end
|