rspec-core 3.0.0.beta1 → 3.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/Changelog.md +137 -0
- data/README.md +2 -2
- data/exe/rspec +2 -23
- data/features/README.md +1 -5
- data/features/command_line/README.md +7 -10
- data/features/command_line/exit_status.feature +1 -1
- data/features/command_line/format_option.feature +1 -1
- data/features/command_line/init.feature +40 -1
- data/features/command_line/line_number_option.feature +2 -2
- data/features/command_line/ruby.feature +5 -4
- data/features/configuration/enable_global_dsl.feature +54 -0
- data/features/example_groups/aliasing.feature +48 -0
- data/features/example_groups/basic_structure.feature +1 -1
- data/features/expectation_framework_integration/configure_expectation_framework.feature +1 -1
- data/features/filtering/if_and_unless.feature +0 -30
- data/features/formatters/custom_formatter.feature +32 -0
- data/features/formatters/regression_tests.feature +95 -0
- data/features/hooks/around_hooks.feature +1 -0
- data/features/hooks/before_and_after_hooks.feature +2 -2
- data/features/mock_framework_integration/use_flexmock.feature +11 -13
- data/features/mock_framework_integration/use_mocha.feature +11 -13
- data/features/mock_framework_integration/use_rr.feature +11 -13
- data/features/mock_framework_integration/use_rspec.feature +11 -13
- data/features/pending_and_skipped_examples/README.md +3 -0
- data/features/pending_and_skipped_examples/pending_examples.feature +118 -0
- data/features/pending_and_skipped_examples/skipped_examples.feature +106 -0
- data/features/step_definitions/additional_cli_steps.rb +34 -0
- data/features/subject/explicit_subject.feature +1 -1
- data/features/subject/one_liner_syntax.feature +71 -0
- data/lib/rspec/core.rb +6 -14
- data/lib/rspec/core/backtrace_formatter.rb +16 -4
- data/lib/rspec/core/command_line.rb +2 -3
- data/lib/rspec/core/configuration.rb +114 -125
- data/lib/rspec/core/configuration_options.rb +32 -18
- data/lib/rspec/core/dsl.rb +80 -18
- data/lib/rspec/core/example.rb +84 -33
- data/lib/rspec/core/example_group.rb +95 -43
- data/lib/rspec/core/filter_manager.rb +31 -40
- data/lib/rspec/core/formatters.rb +137 -0
- data/lib/rspec/core/formatters/base_formatter.rb +28 -41
- data/lib/rspec/core/formatters/base_text_formatter.rb +26 -37
- data/lib/rspec/core/formatters/deprecation_formatter.rb +48 -27
- data/lib/rspec/core/formatters/documentation_formatter.rb +27 -22
- data/lib/rspec/core/formatters/html_formatter.rb +48 -56
- data/lib/rspec/core/formatters/html_printer.rb +11 -18
- data/lib/rspec/core/formatters/json_formatter.rb +18 -22
- data/lib/rspec/core/formatters/legacy_formatter.rb +227 -0
- data/lib/rspec/core/formatters/progress_formatter.rb +7 -10
- data/lib/rspec/core/hooks.rb +250 -217
- data/lib/rspec/core/memoized_helpers.rb +43 -9
- data/lib/rspec/core/mocking_adapters/flexmock.rb +29 -0
- data/lib/rspec/core/{mocking/with_mocha.rb → mocking_adapters/mocha.rb} +19 -16
- data/lib/rspec/core/mocking_adapters/null.rb +12 -0
- data/lib/rspec/core/mocking_adapters/rr.rb +28 -0
- data/lib/rspec/core/mocking_adapters/rspec.rb +30 -0
- data/lib/rspec/core/notifications.rb +100 -0
- data/lib/rspec/core/option_parser.rb +11 -18
- data/lib/rspec/core/pending.rb +78 -47
- data/lib/rspec/core/project_initializer.rb +2 -49
- data/lib/rspec/core/project_initializer/dot_rspec +3 -0
- data/lib/rspec/core/project_initializer/spec_helper.rb +82 -0
- data/lib/rspec/core/rake_task.rb +5 -14
- data/lib/rspec/core/reporter.rb +24 -32
- data/lib/rspec/core/ruby_project.rb +1 -1
- data/lib/rspec/core/runner.rb +14 -4
- data/lib/rspec/core/shared_example_group.rb +40 -13
- data/lib/rspec/core/version.rb +1 -1
- data/spec/command_line/order_spec.rb +15 -15
- data/spec/rspec/core/backtrace_formatter_spec.rb +15 -1
- data/spec/rspec/core/command_line_spec.rb +18 -17
- data/spec/rspec/core/configuration_options_spec.rb +57 -34
- data/spec/rspec/core/configuration_spec.rb +162 -184
- data/spec/rspec/core/drb_command_line_spec.rb +5 -7
- data/spec/rspec/core/drb_options_spec.rb +2 -2
- data/spec/rspec/core/dsl_spec.rb +79 -15
- data/spec/rspec/core/example_group_spec.rb +253 -39
- data/spec/rspec/core/example_spec.rb +149 -33
- data/spec/rspec/core/filter_manager_spec.rb +9 -26
- data/spec/rspec/core/formatters/base_formatter_spec.rb +2 -5
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +42 -145
- data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +64 -34
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +15 -28
- data/spec/rspec/core/formatters/helpers_spec.rb +2 -2
- data/spec/rspec/core/formatters/{html_formatted-1.8.7.html → html_formatted-2.1.0.html} +22 -44
- data/spec/rspec/core/formatters/{html_formatted-1.8.7-jruby.html → html_formatted.html} +30 -49
- data/spec/rspec/core/formatters/html_formatter_spec.rb +35 -19
- data/spec/rspec/core/formatters/json_formatter_spec.rb +42 -40
- data/spec/rspec/core/formatters/legacy_formatter_spec.rb +137 -0
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +38 -25
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +1 -1
- data/spec/rspec/core/formatters_spec.rb +120 -0
- data/spec/rspec/core/hooks_filtering_spec.rb +1 -1
- data/spec/rspec/core/hooks_spec.rb +13 -2
- data/spec/rspec/core/memoized_helpers_spec.rb +17 -8
- data/spec/rspec/core/metadata_spec.rb +3 -3
- data/spec/rspec/core/option_parser_spec.rb +53 -46
- data/spec/rspec/core/ordering_spec.rb +4 -4
- data/spec/rspec/core/pending_example_spec.rb +23 -126
- data/spec/rspec/core/pending_spec.rb +8 -0
- data/spec/rspec/core/project_initializer_spec.rb +8 -41
- data/spec/rspec/core/rake_task_spec.rb +15 -4
- data/spec/rspec/core/random_spec.rb +1 -1
- data/spec/rspec/core/reporter_spec.rb +50 -37
- data/spec/rspec/core/resources/formatter_specs.rb +9 -11
- data/spec/rspec/core/rspec_matchers_spec.rb +1 -1
- data/spec/rspec/core/ruby_project_spec.rb +3 -3
- data/spec/rspec/core/runner_spec.rb +65 -23
- data/spec/rspec/core/shared_context_spec.rb +4 -4
- data/spec/rspec/core/shared_example_group/collection_spec.rb +1 -1
- data/spec/rspec/core/shared_example_group_spec.rb +20 -11
- data/spec/rspec/core/warnings_spec.rb +1 -1
- data/spec/rspec/core/world_spec.rb +10 -10
- data/spec/rspec/core_spec.rb +2 -2
- data/spec/spec_helper.rb +12 -24
- data/spec/support/config_options_helper.rb +1 -3
- data/spec/support/formatter_support.rb +83 -0
- data/spec/support/isolate_load_path_mutation.rb +1 -2
- data/spec/support/isolated_directory.rb +1 -1
- data/spec/support/isolated_home_directory.rb +1 -1
- data/spec/support/legacy_formatter_using_sub_classing_example.rb +87 -0
- data/spec/support/matchers.rb +20 -0
- data/spec/support/mathn_integration_support.rb +2 -2
- data/spec/support/old_style_formatter_example.rb +69 -0
- data/spec/support/shared_example_groups.rb +1 -1
- data/spec/support/spec_files.rb +3 -3
- metadata +192 -69
- metadata.gz.sig +3 -1
- checksums.yaml +0 -15
- checksums.yaml.gz.sig +0 -2
- data/features/configuration/show_failures_in_pending_blocks.feature +0 -61
- data/features/pending/pending_examples.feature +0 -229
- data/features/subject/implicit_receiver.feature +0 -29
- data/lib/rspec/core/mocking/with_absolutely_nothing.rb +0 -11
- data/lib/rspec/core/mocking/with_flexmock.rb +0 -27
- data/lib/rspec/core/mocking/with_rr.rb +0 -27
- data/lib/rspec/core/mocking/with_rspec.rb +0 -27
- data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +0 -477
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +0 -425
- data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +0 -416
- data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +0 -477
- data/spec/rspec/core/formatters/html_formatted-1.9.3.html +0 -419
- data/spec/rspec/core/formatters/html_formatted-2.0.0.html +0 -425
- data/spec/support/in_sub_process.rb +0 -37
- data/spec/support/sandboxed_mock_space.rb +0 -100
@@ -1,37 +0,0 @@
|
|
1
|
-
module InSubProcess
|
2
|
-
if RUBY_PLATFORM == 'java'
|
3
|
-
def in_sub_process
|
4
|
-
pending "This spec requires forking to work properly, " +
|
5
|
-
"and JRuby does not support forking"
|
6
|
-
end
|
7
|
-
else
|
8
|
-
# Useful as a way to isolate a global change to a subprocess.
|
9
|
-
def in_sub_process
|
10
|
-
readme, writeme = IO.pipe
|
11
|
-
|
12
|
-
pid = Process.fork do
|
13
|
-
exception = nil
|
14
|
-
begin
|
15
|
-
yield
|
16
|
-
rescue Exception => e
|
17
|
-
exception = e
|
18
|
-
end
|
19
|
-
|
20
|
-
writeme.write Marshal.dump(exception)
|
21
|
-
|
22
|
-
readme.close
|
23
|
-
writeme.close
|
24
|
-
exit! # prevent at_exit hooks from running (e.g. minitest)
|
25
|
-
end
|
26
|
-
|
27
|
-
writeme.close
|
28
|
-
Process.waitpid(pid)
|
29
|
-
|
30
|
-
exception = Marshal.load(readme.read)
|
31
|
-
readme.close
|
32
|
-
|
33
|
-
raise exception if exception
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'rspec/mocks'
|
2
|
-
|
3
|
-
module RSpec
|
4
|
-
module Core
|
5
|
-
# Because rspec-core dog-foods itself, rspec-core's spec suite has
|
6
|
-
# examples that define example groups and examples and run them. The
|
7
|
-
# usual lifetime of an RSpec::Mocks::Proxy is for one example
|
8
|
-
# (the proxy cache gets cleared between each example), but since the
|
9
|
-
# specs in rspec-core's suite sometimes create test doubles and pass
|
10
|
-
# them to examples a spec defines and runs, the test double's proxy
|
11
|
-
# must live beyond the inner example: it must live for the scope
|
12
|
-
# of wherever it got defined. Here we implement the necessary semantics
|
13
|
-
# for rspec-core's specs:
|
14
|
-
#
|
15
|
-
# - #verify_all and #reset_all affect only mocks that were created
|
16
|
-
# within the current scope.
|
17
|
-
# - Mock proxies live for the duration of the scope in which they are
|
18
|
-
# created.
|
19
|
-
#
|
20
|
-
# Thus, mock proxies created in an inner example live for only that
|
21
|
-
# example, but mock proxies created in an outer example can be used
|
22
|
-
# in an inner example but will only be reset/verified when the outer
|
23
|
-
# example completes.
|
24
|
-
class SandboxedMockSpace < ::RSpec::Mocks::Space
|
25
|
-
def self.sandboxed
|
26
|
-
orig_space = RSpec::Mocks.space
|
27
|
-
RSpec::Mocks.space = RSpec::Core::SandboxedMockSpace.new
|
28
|
-
|
29
|
-
RSpec::Core::Example.class_eval do
|
30
|
-
alias_method :orig_run, :run
|
31
|
-
def run(*args)
|
32
|
-
RSpec::Mocks.space.sandboxed do
|
33
|
-
orig_run(*args)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
yield
|
39
|
-
ensure
|
40
|
-
RSpec::Core::Example.class_eval do
|
41
|
-
remove_method :run
|
42
|
-
alias_method :run, :orig_run
|
43
|
-
remove_method :orig_run
|
44
|
-
end
|
45
|
-
|
46
|
-
RSpec::Mocks.space = orig_space
|
47
|
-
end
|
48
|
-
|
49
|
-
class Sandbox
|
50
|
-
attr_reader :proxies
|
51
|
-
|
52
|
-
def initialize
|
53
|
-
@proxies = Set.new
|
54
|
-
end
|
55
|
-
|
56
|
-
def verify_all
|
57
|
-
@proxies.each { |p| p.verify }
|
58
|
-
end
|
59
|
-
|
60
|
-
def reset_all
|
61
|
-
@proxies.each { |p| p.reset }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def initialize
|
66
|
-
@sandbox_stack = []
|
67
|
-
super
|
68
|
-
end
|
69
|
-
|
70
|
-
def sandboxed
|
71
|
-
@sandbox_stack << Sandbox.new
|
72
|
-
yield
|
73
|
-
ensure
|
74
|
-
@sandbox_stack.pop
|
75
|
-
end
|
76
|
-
|
77
|
-
def verify_all
|
78
|
-
return super unless sandbox = @sandbox_stack.last
|
79
|
-
sandbox.verify_all
|
80
|
-
end
|
81
|
-
|
82
|
-
def reset_all
|
83
|
-
return super unless sandbox = @sandbox_stack.last
|
84
|
-
sandbox.reset_all
|
85
|
-
end
|
86
|
-
|
87
|
-
def proxy_for(object)
|
88
|
-
new_proxy = !proxies.has_key?(object.__id__)
|
89
|
-
proxy = super
|
90
|
-
|
91
|
-
if new_proxy && sandbox = @sandbox_stack.last
|
92
|
-
sandbox.proxies << proxy
|
93
|
-
end
|
94
|
-
|
95
|
-
proxy
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|