rspec-core 2.0.0.a2 → 2.0.0.a3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.document +2 -2
  2. data/.gitignore +1 -0
  3. data/README.markdown +18 -4
  4. data/Rakefile +6 -17
  5. data/bin/rspec +0 -8
  6. data/example_specs/failing/README.txt +1 -1
  7. data/example_specs/failing/spec_helper.rb +7 -2
  8. data/example_specs/failing/team_spec.rb +0 -1
  9. data/features/before_and_after_blocks/around.feature +2 -0
  10. data/features/command_line/example_name_option.feature +54 -0
  11. data/features/command_line/line_number_appended_to_path.feature +39 -0
  12. data/features/command_line/line_number_option.feature +40 -0
  13. data/features/matchers/define_matcher.feature +18 -4
  14. data/features/matchers/define_matcher_outside_rspec.feature +1 -2
  15. data/features/mocks/mix_stubs_and_mocks.feature +2 -0
  16. data/features/subject/explicit_subject.feature +4 -0
  17. data/features/subject/implicit_subject.feature +4 -0
  18. data/features/support/env.rb +15 -1
  19. data/lib/rspec/core.rb +1 -1
  20. data/lib/rspec/core/command_line_options.rb +9 -0
  21. data/lib/rspec/core/configuration.rb +18 -8
  22. data/lib/rspec/core/example.rb +14 -23
  23. data/lib/rspec/core/example_group.rb +39 -30
  24. data/lib/rspec/core/formatters/base_formatter.rb +9 -7
  25. data/lib/rspec/core/formatters/base_text_formatter.rb +2 -2
  26. data/lib/rspec/core/formatters/documentation_formatter.rb +10 -12
  27. data/lib/rspec/core/kernel_extensions.rb +2 -2
  28. data/lib/rspec/core/load_path.rb +1 -2
  29. data/lib/rspec/core/metadata.rb +65 -27
  30. data/lib/rspec/core/ruby_project.rb +24 -10
  31. data/lib/rspec/core/runner.rb +3 -3
  32. data/lib/rspec/core/{shared_behaviour.rb → shared_example_group.rb} +5 -5
  33. data/lib/rspec/core/{shared_behaviour_kernel_extensions.rb → shared_example_group_kernel_extensions.rb} +3 -3
  34. data/lib/rspec/core/version.rb +1 -1
  35. data/lib/rspec/core/world.rb +29 -50
  36. data/rspec-core.gemspec +22 -21
  37. data/spec/rspec/core/command_line_options_spec.rb +14 -0
  38. data/spec/rspec/core/configuration_spec.rb +51 -13
  39. data/spec/rspec/core/example_group_spec.rb +61 -68
  40. data/spec/rspec/core/example_group_subject_spec.rb +1 -1
  41. data/spec/rspec/core/example_spec.rb +19 -8
  42. data/spec/rspec/core/formatters/base_formatter_spec.rb +2 -2
  43. data/spec/rspec/core/metadata_spec.rb +52 -17
  44. data/spec/rspec/core/mocha_spec.rb +4 -4
  45. data/spec/rspec/core/pending_example_spec.rb +19 -0
  46. data/spec/rspec/core/ruby_project_spec.rb +24 -0
  47. data/spec/rspec/core/{shared_behaviour_spec.rb → shared_example_group_spec.rb} +31 -31
  48. data/spec/rspec/core/world_spec.rb +64 -83
  49. data/spec/spec_helper.rb +19 -30
  50. metadata +17 -17
  51. data/features-pending/command_line/line_number_option.feature +0 -56
  52. data/features-pending/command_line/line_number_option_with_example_with_no_name.feature +0 -22
  53. data/lib/rspec/core/extensions/instance_exec.rb +0 -31
  54. data/spec/resources/example_classes.rb +0 -67
  55. data/spec/rspec/core/resources/example_classes.rb +0 -67
@@ -1,14 +1,11 @@
1
- dir = File.dirname(__FILE__)
2
- lib_path = File.expand_path("#{dir}/../lib")
3
- $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
1
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
2
+ require 'rspec/core'
4
3
 
5
4
  require 'rubygems'
6
- $LOAD_PATH.unshift(File.expand_path('../../../expectations/lib'), __FILE__)
5
+ $LOAD_PATH << File.expand_path('../../../expectations/lib', __FILE__)
6
+ $LOAD_PATH << File.expand_path('../../../mocks/lib', __FILE__)
7
7
  require 'rspec/expectations'
8
- $LOAD_PATH.unshift(File.expand_path('../../../mocks/lib'), __FILE__)
9
8
  require 'rspec/mocks'
10
- $LOAD_PATH.unshift(File.expand_path('../../lib'), __FILE__)
11
- require 'rspec/core'
12
9
 
13
10
  Rspec::Core::ExampleGroup.send(:include, Rspec::Matchers)
14
11
 
@@ -16,10 +13,6 @@ def with_ruby(version)
16
13
  yield if RUBY_PLATFORM =~ Regexp.compile("^#{version}")
17
14
  end
18
15
 
19
- require 'rubygems'
20
-
21
- require File.expand_path(File.dirname(__FILE__) + "/resources/example_classes")
22
-
23
16
  module Rspec
24
17
  module Core
25
18
  module Matchers
@@ -34,27 +27,24 @@ module Rspec
34
27
  end
35
28
  end
36
29
 
37
- def remove_last_describe_from_world
38
- Rspec::Core.world.behaviours.pop
30
+ def remove_last_example_group_from_world
31
+ Rspec::Core.world.example_groups.pop
39
32
  end
40
33
 
41
- def isolate_example_group
42
- if block_given?
43
- example_groups = Rspec::Core.world.behaviours.dup
44
- begin
45
- Rspec::Core.world.behaviours.clear
46
- yield
47
- ensure
48
- Rspec::Core.world.behaviours.clear
49
- Rspec::Core.world.behaviours.concat(example_groups)
50
- end
51
- end
34
+ def disconnect_from_world
35
+ example_groups = Rspec::Core.world.example_groups.dup
36
+ Rspec::Core.world.example_groups.clear
37
+ yield
38
+ ensure
39
+ Rspec::Core.world.example_groups.clear
40
+ Rspec::Core.world.example_groups.concat(example_groups)
52
41
  end
53
42
 
54
- def double_describe(*args)
55
- group = Rspec::Core::ExampleGroup.describe(*args) {}
56
- remove_last_describe_from_world
57
- yield group if block_given?
43
+ def isolated_example_group(*args, &block)
44
+ block ||= lambda {}
45
+ args << 'example group' if args.empty?
46
+ group = Rspec::Core::ExampleGroup.describe(*args, &block)
47
+ remove_last_example_group_from_world
58
48
  group
59
49
  end
60
50
 
@@ -72,8 +62,7 @@ end
72
62
 
73
63
  Rspec::Core.configure do |c|
74
64
  c.mock_framework = :rspec
75
- # c.filter_run :focused => true
76
- # TODO: Filter run needs normal before/after/include filter logic
77
65
  c.filter_run :focused => true
66
+ c.run_all_when_everything_filtered = true
78
67
  c.color_enabled = not_in_editor?
79
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.a2
4
+ version: 2.0.0.a3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-24 00:00:00 -06:00
13
+ date: 2010-02-03 00:00:00 -06:00
14
14
  default_executable: rspec
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 2.0.0.a2
24
+ version: 2.0.0.a3
25
25
  version:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec-mocks
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.0.a2
34
+ version: 2.0.0.a3
35
35
  version:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
@@ -43,7 +43,7 @@ dependencies:
43
43
  - !ruby/object:Gem::Version
44
44
  version: 0.5.3
45
45
  version:
46
- description:
46
+ description: Rspec runner and example group classes
47
47
  email: dchelimsky@gmail.com;chad.humphries@gmail.com
48
48
  executables:
49
49
  - rspec
@@ -108,8 +108,6 @@ files:
108
108
  - example_specs/passing/stubbing_example.rb
109
109
  - example_specs/passing/yielding_example.rb
110
110
  - example_specs/ruby1.9.compatibility/access_to_constants_spec.rb
111
- - features-pending/command_line/line_number_option.feature
112
- - features-pending/command_line/line_number_option_with_example_with_no_name.feature
113
111
  - features-pending/example_groups/example_group_with_should_methods.feature
114
112
  - features-pending/example_groups/implicit_docstrings.feature
115
113
  - features-pending/expectations/expect_change.feature
@@ -128,6 +126,9 @@ files:
128
126
  - features-pending/runner/specify_line_number.feature
129
127
  - features/before_and_after_blocks/around.feature
130
128
  - features/before_and_after_blocks/before_and_after_blocks.feature
129
+ - features/command_line/example_name_option.feature
130
+ - features/command_line/line_number_appended_to_path.feature
131
+ - features/command_line/line_number_option.feature
131
132
  - features/example_groups/describe_aliases.feature
132
133
  - features/example_groups/nested_groups.feature
133
134
  - features/expectations/customized_message.feature
@@ -154,7 +155,6 @@ files:
154
155
  - lib/rspec/core/example.rb
155
156
  - lib/rspec/core/example_group.rb
156
157
  - lib/rspec/core/example_group_subject.rb
157
- - lib/rspec/core/extensions/instance_exec.rb
158
158
  - lib/rspec/core/formatters.rb
159
159
  - lib/rspec/core/formatters/base_formatter.rb
160
160
  - lib/rspec/core/formatters/base_text_formatter.rb
@@ -171,13 +171,12 @@ files:
171
171
  - lib/rspec/core/rake_task.rb
172
172
  - lib/rspec/core/ruby_project.rb
173
173
  - lib/rspec/core/runner.rb
174
- - lib/rspec/core/shared_behaviour.rb
175
- - lib/rspec/core/shared_behaviour_kernel_extensions.rb
174
+ - lib/rspec/core/shared_example_group.rb
175
+ - lib/rspec/core/shared_example_group_kernel_extensions.rb
176
176
  - lib/rspec/core/version.rb
177
177
  - lib/rspec/core/world.rb
178
178
  - rspec-core.gemspec
179
179
  - script/console
180
- - spec/resources/example_classes.rb
181
180
  - spec/rspec/core/command_line_options_spec.rb
182
181
  - spec/rspec/core/configuration_spec.rb
183
182
  - spec/rspec/core/example_group_spec.rb
@@ -189,14 +188,15 @@ files:
189
188
  - spec/rspec/core/kernel_extensions_spec.rb
190
189
  - spec/rspec/core/metadata_spec.rb
191
190
  - spec/rspec/core/mocha_spec.rb
191
+ - spec/rspec/core/pending_example_spec.rb
192
192
  - spec/rspec/core/resources/a_bar.rb
193
193
  - spec/rspec/core/resources/a_foo.rb
194
194
  - spec/rspec/core/resources/a_spec.rb
195
195
  - spec/rspec/core/resources/custom_example_group_runner.rb
196
- - spec/rspec/core/resources/example_classes.rb
197
196
  - spec/rspec/core/resources/utf8_encoded.rb
197
+ - spec/rspec/core/ruby_project_spec.rb
198
198
  - spec/rspec/core/runner_spec.rb
199
- - spec/rspec/core/shared_behaviour_spec.rb
199
+ - spec/rspec/core/shared_example_group_spec.rb
200
200
  - spec/rspec/core/world_spec.rb
201
201
  - spec/rspec/core_spec.rb
202
202
  - spec/ruby_forker.rb
@@ -229,9 +229,8 @@ rubyforge_project: rspec
229
229
  rubygems_version: 1.3.5
230
230
  signing_key:
231
231
  specification_version: 3
232
- summary: Rspec runner and example group classes
232
+ summary: rspec-core 2.0.0.a3
233
233
  test_files:
234
- - spec/resources/example_classes.rb
235
234
  - spec/rspec/core/command_line_options_spec.rb
236
235
  - spec/rspec/core/configuration_spec.rb
237
236
  - spec/rspec/core/example_group_spec.rb
@@ -243,14 +242,15 @@ test_files:
243
242
  - spec/rspec/core/kernel_extensions_spec.rb
244
243
  - spec/rspec/core/metadata_spec.rb
245
244
  - spec/rspec/core/mocha_spec.rb
245
+ - spec/rspec/core/pending_example_spec.rb
246
246
  - spec/rspec/core/resources/a_bar.rb
247
247
  - spec/rspec/core/resources/a_foo.rb
248
248
  - spec/rspec/core/resources/a_spec.rb
249
249
  - spec/rspec/core/resources/custom_example_group_runner.rb
250
- - spec/rspec/core/resources/example_classes.rb
251
250
  - spec/rspec/core/resources/utf8_encoded.rb
251
+ - spec/rspec/core/ruby_project_spec.rb
252
252
  - spec/rspec/core/runner_spec.rb
253
- - spec/rspec/core/shared_behaviour_spec.rb
253
+ - spec/rspec/core/shared_example_group_spec.rb
254
254
  - spec/rspec/core/world_spec.rb
255
255
  - spec/rspec/core_spec.rb
256
256
  - spec/ruby_forker.rb
@@ -1,56 +0,0 @@
1
- Feature: Spec and test together
2
-
3
- As an RSpec user
4
- I want to run one example identified by the line number
5
-
6
- Background:
7
- Given a file named "example.rb" with:
8
- """
9
- describe "a group" do
10
-
11
- it "has a first example" do
12
-
13
- end
14
-
15
- it "has a second example" do
16
-
17
- end
18
-
19
- end
20
- """
21
-
22
- Scenario: two examples - first example on declaration line
23
- When I run "spec example.rb:3 --format nested"
24
- Then the stdout should match "1 example, 0 failures"
25
- And the stdout should match "has a first example"
26
- But the stdout should not match "has a second example"
27
-
28
- Scenario: two examples - first example from line inside declaration
29
- When I run "spec example.rb:4 --format nested"
30
- Then the stdout should match "1 example, 0 failures"
31
- And the stdout should match "has a first example"
32
- But the stdout should not match "has a second example"
33
-
34
- Scenario: two examples - first example from line below declaration
35
- When I run "spec example.rb:6 --format nested"
36
- Then the stdout should match "1 example, 0 failures"
37
- And the stdout should match "has a first example"
38
- But the stdout should not match "has a second example"
39
-
40
- Scenario: two examples - second example from line below declaration
41
- When I run "spec example.rb:7 --format nested"
42
- Then the stdout should match "1 example, 0 failures"
43
- And the stdout should match "has a second example"
44
- But the stdout should not match "has a first example"
45
-
46
- Scenario: two examples - both examples from the group declaration
47
- When I run "spec example.rb:1 --format nested"
48
- Then the stdout should match "2 examples, 0 failures"
49
- And the stdout should match "has a second example"
50
- And the stdout should match "has a first example"
51
-
52
- Scenario: two examples - both examples from above the first example declaration
53
- When I run "spec example.rb:2 --format nested"
54
- Then the stdout should match "2 examples, 0 failures"
55
- And the stdout should match "has a second example"
56
- And the stdout should match "has a first example"
@@ -1,22 +0,0 @@
1
- Feature: Spec and test together
2
-
3
- As an RSpec user
4
- I want to run one example identified by the line number
5
-
6
- Background:
7
- Given a file named "example.rb" with:
8
- """
9
- describe 9 do
10
-
11
- it { should be > 8 }
12
-
13
- it { should be < 10 }
14
-
15
- end
16
- """
17
-
18
- Scenario: two examples - first example on declaration line
19
- When I run "spec example.rb:3 --format nested"
20
- Then the stdout should match "1 example, 0 failures"
21
- Then the stdout should match "should be > 8"
22
- But the stdout should not match "should be < 10"
@@ -1,31 +0,0 @@
1
- module Rspec
2
- module Core
3
- module InstanceExec
4
- unless respond_to?(:instance_exec)
5
- # based on Bounded Spec InstanceExec (Mauricio Fernandez)
6
- # http://eigenclass.org/hiki/bounded+space+instance_exec
7
- # - uses singleton_class of matcher instead of global
8
- # InstanceExecHelper module
9
- # - this keeps it scoped to this class only, which is the
10
- # only place we need it
11
- # - only necessary for ruby 1.8.6
12
- def instance_exec(*args, &block)
13
- singleton_class = (class << self; self; end)
14
- begin
15
- orig_critical, Thread.critical = Thread.critical, true
16
- n = 0
17
- n += 1 while respond_to?(method_name="__instance_exec#{n}")
18
- singleton_class.module_eval{ define_method(:__instance_exec, &block) }
19
- ensure
20
- Thread.critical = orig_critical
21
- end
22
- begin
23
- return send(:__instance_exec, *args)
24
- ensure
25
- singleton_class.module_eval{ remove_method(:__instance_exec) } rescue nil
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,67 +0,0 @@
1
- # This file contains various classes used by the specs.
2
- module Rspec::Core
3
- module Expectations
4
- class Person
5
- attr_reader :name
6
- def initialize name
7
- @name = name
8
- end
9
- def == other
10
- return @name == other.name
11
- end
12
- end
13
-
14
- class ClassWithMultiWordPredicate
15
- def multi_word_predicate?
16
- true
17
- end
18
- end
19
-
20
- module Helper
21
- class CollectionWithSizeMethod
22
- def initialize; @list = []; end
23
- def size; @list.size; end
24
- def push(item); @list.push(item); end
25
- end
26
-
27
- class CollectionWithLengthMethod
28
- def initialize; @list = []; end
29
- def length; @list.size; end
30
- def push(item); @list.push(item); end
31
- end
32
-
33
- class CollectionOwner
34
- attr_reader :items_in_collection_with_size_method, :items_in_collection_with_length_method
35
-
36
- def initialize
37
- @items_in_collection_with_size_method = CollectionWithSizeMethod.new
38
- @items_in_collection_with_length_method = CollectionWithLengthMethod.new
39
- end
40
-
41
- def add_to_collection_with_size_method(item)
42
- @items_in_collection_with_size_method.push(item)
43
- end
44
-
45
- def add_to_collection_with_length_method(item)
46
- @items_in_collection_with_length_method.push(item)
47
- end
48
-
49
- def items_for(arg)
50
- return [1, 2, 3] if arg == 'a'
51
- [1]
52
- end
53
-
54
- def items
55
- @items_in_collection_with_size_method
56
- end
57
- end
58
-
59
- class ClassWithUnqueriedPredicate
60
- attr_accessor :foo
61
- def initialize(foo)
62
- @foo = foo
63
- end
64
- end
65
- end
66
- end
67
- end
@@ -1,67 +0,0 @@
1
- # This file contains various classes used by the specs.
2
- module Rspec::Core
3
- module Expectations
4
- class Person
5
- attr_reader :name
6
- def initialize name
7
- @name = name
8
- end
9
- def == other
10
- return @name == other.name
11
- end
12
- end
13
-
14
- class ClassWithMultiWordPredicate
15
- def multi_word_predicate?
16
- true
17
- end
18
- end
19
-
20
- module Helper
21
- class CollectionWithSizeMethod
22
- def initialize; @list = []; end
23
- def size; @list.size; end
24
- def push(item); @list.push(item); end
25
- end
26
-
27
- class CollectionWithLengthMethod
28
- def initialize; @list = []; end
29
- def length; @list.size; end
30
- def push(item); @list.push(item); end
31
- end
32
-
33
- class CollectionOwner
34
- attr_reader :items_in_collection_with_size_method, :items_in_collection_with_length_method
35
-
36
- def initialize
37
- @items_in_collection_with_size_method = CollectionWithSizeMethod.new
38
- @items_in_collection_with_length_method = CollectionWithLengthMethod.new
39
- end
40
-
41
- def add_to_collection_with_size_method(item)
42
- @items_in_collection_with_size_method.push(item)
43
- end
44
-
45
- def add_to_collection_with_length_method(item)
46
- @items_in_collection_with_length_method.push(item)
47
- end
48
-
49
- def items_for(arg)
50
- return [1, 2, 3] if arg == 'a'
51
- [1]
52
- end
53
-
54
- def items
55
- @items_in_collection_with_size_method
56
- end
57
- end
58
-
59
- class ClassWithUnqueriedPredicate
60
- attr_accessor :foo
61
- def initialize(foo)
62
- @foo = foo
63
- end
64
- end
65
- end
66
- end
67
- end