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
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'opal/rspec/sprockets_environment'
|
3
|
+
require_relative 'temp_dir_helper'
|
4
|
+
|
5
|
+
describe Opal::RSpec::SprocketsEnvironment do
|
6
|
+
include_context :temp_dir
|
7
|
+
let(:args) { [] }
|
8
|
+
subject(:env) { Opal::RSpec::SprocketsEnvironment.new *args }
|
9
|
+
|
10
|
+
RSpec::Matchers.define :have_pathnames do |expected|
|
11
|
+
expected = expected.map {|p| File.expand_path(p) }
|
12
|
+
|
13
|
+
match do |actual|
|
14
|
+
actual == expected
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#cached' do
|
19
|
+
subject { env.cached }
|
20
|
+
|
21
|
+
it { is_expected.to be_a ::Opal::RSpec::CachedEnvironment }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#add_spec_paths_to_sprockets' do
|
25
|
+
let(:args) { [pattern] }
|
26
|
+
|
27
|
+
subject do
|
28
|
+
# in subject to allow contexts to execute before logic
|
29
|
+
env.add_spec_paths_to_sprockets
|
30
|
+
env.paths.sort
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'specs all 1 in path' do
|
34
|
+
before do
|
35
|
+
create_dummy_spec_files 'spec/foobar/dummy_spec.rb', 'spec/foobar/ignored_spec.opal'
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:pattern) { 'spec/foobar/**/*_spec.rb' }
|
39
|
+
|
40
|
+
it { is_expected.to have_pathnames ['spec/foobar/'] }
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'multiple patterns' do
|
44
|
+
before do
|
45
|
+
create_dummy_spec_files 'spec/foobar/dummy_spec.rb', 'spec/foobar/ignored_spec.opal'
|
46
|
+
end
|
47
|
+
|
48
|
+
let(:pattern) { ['spec/foobar/**/*_spec.rb', 'spec/foobar/**/*_spec.opal'] }
|
49
|
+
|
50
|
+
it { is_expected.to have_pathnames ['spec/foobar/'] }
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'specs in different paths, same root' do
|
54
|
+
before do
|
55
|
+
create_dummy_spec_files 'spec/foobar/dummy_spec.rb', 'spec/noway/other_spec.rb'
|
56
|
+
end
|
57
|
+
|
58
|
+
let(:pattern) { ['spec/foobar/**/*y_spec.rb', 'spec/noway/**/*_spec.rb'] }
|
59
|
+
|
60
|
+
it { is_expected.to have_pathnames ['spec'] }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'specs in different paths, different root' do
|
64
|
+
before do
|
65
|
+
create_dummy_spec_files 'spec/foobar/dummy_spec.rb', 'other_path/other_spec.rb'
|
66
|
+
end
|
67
|
+
|
68
|
+
let(:pattern) { ['spec/foobar/**/*_spec.rb', 'other_path/**/*.rb'] }
|
69
|
+
|
70
|
+
it { is_expected.to have_pathnames ['other_path/', 'spec/foobar/'] }
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'specs in different paths, same name in middle dirs' do
|
74
|
+
before do
|
75
|
+
create_dummy_spec_files 'foobar/spec/something/dummy_spec.rb', 'spec/foobar/other_spec.rb'
|
76
|
+
end
|
77
|
+
|
78
|
+
let(:pattern) { ['foobar/spec/**/*_spec.rb', 'spec/foobar/other_spec.rb'] }
|
79
|
+
|
80
|
+
it { is_expected.to have_pathnames ['foobar/spec/', 'spec/foobar'] }
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'absolute path and relative path that are not in the same tree' do
|
84
|
+
before do
|
85
|
+
create_dummy_spec_files 'spec/foobar/dummy_spec.rb', 'stuff/bar/other_spec.rb'
|
86
|
+
end
|
87
|
+
|
88
|
+
let(:files) { FileList['spec/foobar/**/*_spec.rb', 'stuff/bar/other_spec.rb'] }
|
89
|
+
let(:args) { [nil, nil, files] }
|
90
|
+
|
91
|
+
it { is_expected.to have_pathnames ['spec/foobar', 'stuff/bar'] }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
RSpec.shared_context :temp_dir do
|
2
|
+
before do
|
3
|
+
@temp_dir = Dir.mktmpdir
|
4
|
+
@current_dir = Dir.pwd
|
5
|
+
Dir.chdir @temp_dir
|
6
|
+
end
|
7
|
+
|
8
|
+
after do
|
9
|
+
Dir.chdir @current_dir
|
10
|
+
FileUtils.rm_rf @temp_dir
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_dummy_spec_files(*files)
|
14
|
+
files.each do |file|
|
15
|
+
FileUtils.mkdir_p File.dirname(file)
|
16
|
+
FileUtils.touch file
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
File without changes
|
@@ -10,57 +10,57 @@ describe 'hooks' do
|
|
10
10
|
@@around_completed = 0
|
11
11
|
@@around_failures = []
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
after :all do
|
15
15
|
raise @@around_failures.join "\n" if @@around_failures.any?
|
16
16
|
raise 'hooks not empty!' unless @@around_stack.empty?
|
17
17
|
unless @@around_completed == @@expected_around_hits
|
18
|
-
msg = "Expected #{@@expected_around_hits} around hits but got #{@@around_completed} for #{self}"
|
18
|
+
msg = "Expected #{@@expected_around_hits} around hits but got #{@@around_completed} for #{self}"
|
19
19
|
`console.error(#{msg})`
|
20
|
-
end
|
21
|
-
end
|
20
|
+
end
|
21
|
+
end
|
22
22
|
end
|
23
23
|
RSpec.shared_context :async_spec_mix do
|
24
|
-
include_context :around_count
|
25
|
-
|
26
|
-
context 'matches' do
|
24
|
+
include_context :around_count
|
25
|
+
|
26
|
+
context 'matches' do
|
27
27
|
it 'async match' do
|
28
28
|
delay_with_promise 0 do
|
29
29
|
1.should == 1
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it 'sync match' do
|
34
34
|
1.should == 1
|
35
|
-
end
|
36
|
-
|
35
|
+
end
|
36
|
+
|
37
37
|
it 'sync fails properly' do
|
38
38
|
1.should == 2
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it 'another async match' do
|
42
42
|
delay_with_promise 0 do
|
43
43
|
1.should == 1
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
it 'async match fails properly' do
|
48
48
|
delay_with_promise 0 do
|
49
49
|
1.should == 2
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
context 'before(:each) fails' do
|
55
55
|
before do
|
56
56
|
raise 'before fails properly'
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it 'should not reach the example' do
|
60
60
|
fail 'we reached the example and we should not have!'
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
context 'after(:each)' do
|
65
65
|
context 'async' do
|
66
66
|
after do
|
@@ -68,156 +68,97 @@ describe 'hooks' do
|
|
68
68
|
raise 'after fails properly' if raise_after_exception
|
69
69
|
end
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
context 'passes' do
|
73
73
|
let(:raise_after_exception) { false }
|
74
|
-
|
74
|
+
|
75
75
|
it 'sync match passes' do
|
76
76
|
1.should == 1
|
77
|
-
end
|
77
|
+
end
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
context 'fails' do
|
81
81
|
let(:raise_after_exception) { true }
|
82
|
-
|
82
|
+
|
83
83
|
it 'sync match passes' do
|
84
84
|
1.should == 1
|
85
|
-
end
|
85
|
+
end
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
context 'sync' do
|
90
90
|
after do
|
91
91
|
raise 'after fails properly' if raise_after_exception
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
context 'passes' do
|
95
95
|
let(:raise_after_exception) { false }
|
96
|
-
|
96
|
+
|
97
97
|
it 'sync match passes' do
|
98
98
|
1.should == 1
|
99
|
-
end
|
99
|
+
end
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
context 'fails' do
|
103
103
|
let(:raise_after_exception) { true }
|
104
|
-
|
104
|
+
|
105
105
|
it 'sync match passes' do
|
106
106
|
1.should == 1
|
107
|
-
end
|
107
|
+
end
|
108
108
|
end
|
109
109
|
end
|
110
|
-
end
|
110
|
+
end
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
let(:fail_before_example_run) { false }
|
114
114
|
let(:fail_after_example_run) { false }
|
115
115
|
let(:skip_run) { false }
|
116
|
-
|
116
|
+
|
117
117
|
context 'sync' do
|
118
|
-
subject { 42 }
|
119
|
-
|
118
|
+
subject { 42 }
|
119
|
+
|
120
120
|
around do |example|
|
121
|
-
raise 'around failed before example properly' if fail_before_example_run
|
121
|
+
raise 'around failed before example properly' if fail_before_example_run
|
122
122
|
look_for = example.description
|
123
|
-
@@around_stack << look_for
|
123
|
+
@@around_stack << look_for
|
124
124
|
example.run unless skip_run
|
125
125
|
last = @@around_stack.pop
|
126
126
|
@@around_failures << "Around hook kept executing even though test #{@test_in_progress} was running!" if @test_in_progress
|
127
127
|
@@around_failures << "Around hooks are messed up because we expected #{look_for} but we popped off #{last}" unless last == look_for
|
128
128
|
@@around_completed += 1
|
129
|
-
raise 'around failed after example properly' if fail_after_example_run
|
129
|
+
raise 'around failed after example properly' if fail_after_example_run
|
130
130
|
end
|
131
|
-
|
132
|
-
context 'succeeds' do
|
131
|
+
|
132
|
+
context 'succeeds' do
|
133
133
|
before :context do
|
134
134
|
@@expected_around_hits = 1
|
135
135
|
end
|
136
136
|
include_context :around_count
|
137
|
-
|
137
|
+
|
138
138
|
it { is_expected.to equal 42 }
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
context 'fails before example' do
|
142
142
|
before :context do
|
143
143
|
@@expected_around_hits = 0
|
144
144
|
end
|
145
145
|
include_context :around_count
|
146
|
-
|
146
|
+
|
147
147
|
let(:fail_before_example_run) { true }
|
148
|
-
|
148
|
+
|
149
149
|
it { is_expected.to equal 42 }
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
context 'fails after example' do
|
153
153
|
before :context do
|
154
154
|
@@expected_around_hits = 1
|
155
155
|
end
|
156
156
|
include_context :around_count
|
157
|
-
|
157
|
+
|
158
158
|
let(:fail_after_example_run) { true }
|
159
|
-
|
159
|
+
|
160
160
|
it { is_expected.to equal 42 }
|
161
161
|
end
|
162
162
|
end
|
163
|
-
|
164
|
-
context 'async' do
|
165
|
-
around do |example|
|
166
|
-
raise 'around failed before example properly' if fail_before_example_run
|
167
|
-
look_for = example.description
|
168
|
-
@@around_stack << look_for
|
169
|
-
clean_ending = lambda do
|
170
|
-
last = @@around_stack.pop
|
171
|
-
@@around_failures << "Around hook kept executing even though test #{@test_in_progress} was running!" if @test_in_progress
|
172
|
-
@@around_failures << "Around hooks are messed up because we expected #{look_for} but we popped off #{last}" unless last == look_for
|
173
|
-
@@around_completed += 1
|
174
|
-
raise 'around failed after example properly' if fail_after_example_run
|
175
|
-
end
|
176
|
-
if skip_run
|
177
|
-
clean_ending.call
|
178
|
-
else
|
179
|
-
example.run.then do
|
180
|
-
clean_ending.call
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
context 'succeeds' do
|
186
|
-
before :context do
|
187
|
-
@@expected_around_hits = 10
|
188
|
-
end
|
189
|
-
|
190
|
-
include_context :async_spec_mix
|
191
|
-
end
|
192
|
-
|
193
|
-
context 'fails before example' do
|
194
|
-
before :context do
|
195
|
-
@@expected_around_hits = 0
|
196
|
-
end
|
197
|
-
|
198
|
-
let(:fail_before_example_run) { true }
|
199
|
-
|
200
|
-
include_context :async_spec_mix
|
201
|
-
end
|
202
|
-
|
203
|
-
context 'fails after example' do
|
204
|
-
before :context do
|
205
|
-
@@expected_around_hits = 10
|
206
|
-
end
|
207
|
-
|
208
|
-
let(:fail_after_example_run) { true }
|
209
|
-
|
210
|
-
include_context :async_spec_mix
|
211
|
-
end
|
212
|
-
|
213
|
-
context 'skip' do
|
214
|
-
before :context do
|
215
|
-
@@expected_around_hits = 10
|
216
|
-
end
|
217
|
-
|
218
|
-
let(:skip_run) { true }
|
219
|
-
include_context :async_spec_mix
|
220
|
-
end
|
221
|
-
end
|
222
163
|
end
|
223
164
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,40 @@
|
|
1
|
+
promise should make example fail properly before async block reached
|
2
|
+
promise matcher fails properly
|
3
|
+
promise non-assertion failure in promise no args
|
4
|
+
promise non-assertion failure in promise string arg
|
5
|
+
promise non-assertion failure in promise exception arg
|
6
|
+
pending in example no promise would not fail otherwise, thus fails properly FIXED
|
7
|
+
async/sync mix fails properly if a sync test is among async tests
|
8
|
+
async/sync mix can finish running after a long delay and fail properly
|
9
|
+
be_truthy fails properly with truthy values
|
10
|
+
subject sync unnamed assertion fails properly should eq 43
|
11
|
+
subject sync unnamed fails properly during subject create
|
12
|
+
subject async assertion implicit fails properly should eq 43
|
13
|
+
subject async fails properly during creation explicit async
|
14
|
+
subject async fails properly during creation implicit usage
|
15
|
+
subject async assertion explicit async fails properly
|
16
|
+
hooks around sync fails after example should equal 42
|
17
|
+
hooks around sync fails before example
|
18
|
+
hooks before async with async subject async match fails properly
|
19
|
+
hooks before async with async subject before :each fails properly should not reach the example
|
20
|
+
hooks before async with async subject before :each succeeds, assertion fails properly should not eq 42
|
21
|
+
hooks before async with async subject before :each succeeds, subject fails properly should not reach the example
|
22
|
+
hooks before async with async subject both subject and before(:each) fail properly should not reach the example
|
23
|
+
hooks before async with sync subject async match fails properly
|
24
|
+
hooks before async with sync subject before :each fails properly should not reach the example
|
25
|
+
hooks before async with sync subject match fails properly should not eq 42
|
26
|
+
hooks before sync with sync subject context fails properly should not reach the example
|
27
|
+
hooks before sync with sync subject before :each fails properly should not reach the example
|
28
|
+
hooks before sync with sync subject match fails properly should not eq 42
|
29
|
+
hooks before sync with sync subject first before :each in chain triggers failure inner context should not reach the example
|
30
|
+
hooks after sync after fails should eq 42
|
31
|
+
hooks after sync before fails should not reach the example
|
32
|
+
hooks after sync match fails async match
|
33
|
+
hooks after sync match fails sync match should eq 43
|
34
|
+
hooks after async after(:each) fails properly
|
35
|
+
hooks after async before(:each) fails properly
|
36
|
+
hooks after async match fails properly async match
|
37
|
+
hooks after async match fails properly sync match should eq 43
|
38
|
+
exception handling should fail properly if an exception is raised
|
39
|
+
exception handling should ignore an exception after a failed assertion
|
40
|
+
legacy async fails properly after a long delay
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe 'subject' do
|
1
|
+
describe 'subject' do
|
2
2
|
context 'sync' do
|
3
3
|
context 'named' do
|
4
4
|
subject(:named_subject) { [1, 2, 3] }
|
@@ -9,30 +9,30 @@ describe 'subject' do
|
|
9
9
|
|
10
10
|
it "should be the named subject" do
|
11
11
|
subject.should eql(named_subject)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
15
|
context 'unnamed' do
|
16
16
|
subject { 42 }
|
17
|
-
|
17
|
+
|
18
18
|
context 'passes' do
|
19
19
|
it { is_expected.to eq 42 }
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
context 'assertion fails properly' do
|
23
23
|
it { is_expected.to eq 43 }
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
context 'fails properly during subject create' do
|
27
27
|
subject do
|
28
28
|
raise 'did not work'
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
it { is_expected.to eq 42 }
|
32
|
-
end
|
32
|
+
end
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
context 'async' do
|
37
37
|
describe 'assertion' do
|
38
38
|
subject do
|
@@ -40,21 +40,21 @@ describe 'subject' do
|
|
40
40
|
42
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
context 'explicit async' do
|
45
45
|
it 'passes' do
|
46
46
|
delay_with_promise 0 do
|
47
47
|
expect(subject).to eq 42
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it 'fails properly' do
|
52
52
|
delay_with_promise 0 do
|
53
53
|
expect(subject).to eq 43
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
context 'implicit' do
|
59
59
|
context 'passes' do
|
60
60
|
it { is_expected.to eq 42 }
|
@@ -62,8 +62,8 @@ describe 'subject' do
|
|
62
62
|
|
63
63
|
context 'fails properly' do
|
64
64
|
it { is_expected.to eq 43 }
|
65
|
-
end
|
66
|
-
end
|
65
|
+
end
|
66
|
+
end
|
67
67
|
end
|
68
68
|
|
69
69
|
context 'fails properly during creation' do
|
@@ -76,7 +76,7 @@ describe 'subject' do
|
|
76
76
|
context 'implicit usage' do
|
77
77
|
it { is_expected.to eq 42 }
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
it 'explicit async' do
|
81
81
|
delay_with_promise 0 do
|
82
82
|
expect(subject).to eq 42
|