rspec-core 2.0.0.beta.2 → 2.0.0.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -7,4 +7,3 @@ pkg
7
7
  tmp
8
8
  tags
9
9
  rerun.txt
10
- *.gemspec
data/Rakefile CHANGED
@@ -39,6 +39,13 @@ rescue LoadError
39
39
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
40
40
  end
41
41
 
42
+ namespace :gem do
43
+ desc "push to gemcutter"
44
+ task :push => :build do
45
+ system "gem push pkg/rspec-core-#{Rspec::Core::Version::STRING}.gem"
46
+ end
47
+ end
48
+
42
49
  Rspec::Core::RakeTask.new(:spec)
43
50
 
44
51
  desc "Run all examples using rcov"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta.2
1
+ 2.0.0.beta.3
@@ -69,7 +69,7 @@ module Rspec
69
69
 
70
70
  def self.set_it_up(*args)
71
71
  @configuration = args.shift
72
- @metadata = Rspec::Core::Metadata.process(superclass_metadata, *args)
72
+ @metadata = Rspec::Core::Metadata.new(superclass_metadata).process(*args)
73
73
 
74
74
  configuration.find_modules(self).each do |include_or_extend, mod, opts|
75
75
  if include_or_extend == :extend
@@ -85,7 +85,7 @@ module Rspec
85
85
  end
86
86
 
87
87
  def self.display_name
88
- metadata[:example_group][:name]
88
+ metadata[:example_group][:description]
89
89
  end
90
90
 
91
91
  def self.description
@@ -16,10 +16,8 @@ module Rspec
16
16
 
17
17
  described_example_group_chain.each_with_index do |nested_example_group, i|
18
18
  unless nested_example_group == @previous_nested_example_groups[i]
19
- at_root_level = (i == 0)
20
- desc_or_name = at_root_level ? nested_example_group.display_name : nested_example_group.description
21
- output.puts if at_root_level
22
- output.puts "#{' ' * i}#{desc_or_name}"
19
+ output.puts if i == 0
20
+ output.puts "#{' ' * i}#{nested_example_group.description}"
23
21
  end
24
22
  end
25
23
 
@@ -2,14 +2,6 @@ module Rspec
2
2
  module Core
3
3
  class Metadata < Hash
4
4
 
5
- def self.process(superclass_metadata, *args)
6
- new(superclass_metadata) do |metadata|
7
- metadata.process(*args)
8
- end
9
- end
10
-
11
- attr_reader :superclass_metadata
12
-
13
5
  def initialize(superclass_metadata=nil)
14
6
  @superclass_metadata = superclass_metadata
15
7
  update(@superclass_metadata) if @superclass_metadata
@@ -18,23 +10,54 @@ module Rspec
18
10
  yield self if block_given?
19
11
  end
20
12
 
13
+ RESERVED_KEYS = [
14
+ :behaviour,
15
+ :description,
16
+ :example_group,
17
+ :execution_result,
18
+ :file_path,
19
+ :full_description,
20
+ :line_number,
21
+ :location
22
+ ]
23
+
21
24
  def process(*args)
22
- extra_metadata = args.last.is_a?(Hash) ? args.pop : {}
23
- extra_metadata.delete(:example_group) # Remove it when present to prevent it clobbering the one we setup
24
- extra_metadata.delete(:behaviour) # Remove it when present to prevent it clobbering the one we setup
25
-
26
- self[:example_group][:describes] = args.shift unless args.first.is_a?(String)
27
- self[:example_group][:describes] ||= self.superclass_metadata && self.superclass_metadata[:example_group][:describes]
28
- self[:example_group][:description] = args.shift || ''
29
-
30
- self[:example_group][:name] = determine_name
31
- self[:example_group][:block] = extra_metadata.delete(:example_group_block)
32
- self[:example_group][:caller] = extra_metadata.delete(:caller)
33
- self[:example_group][:file_path] = file_path_from(self[:example_group], extra_metadata.delete(:file_path))
34
- self[:example_group][:line_number] = line_number_from(self[:example_group], extra_metadata.delete(:line_number))
25
+ user_metadata = args.last.is_a?(Hash) ? args.pop : {}
26
+ ensure_valid_keys(user_metadata)
27
+
28
+ self[:example_group][:describes] = described_class_from(args)
29
+ self[:example_group][:description] = description_from(args)
30
+ self[:example_group][:full_description] = full_description_from(args)
31
+
32
+ self[:example_group][:block] = user_metadata.delete(:example_group_block)
33
+ self[:example_group][:caller] = user_metadata.delete(:caller) || caller(1)
34
+ self[:example_group][:file_path] = file_path_from(self[:example_group], user_metadata.delete(:file_path))
35
+ self[:example_group][:line_number] = line_number_from(self[:example_group], user_metadata.delete(:line_number))
35
36
  self[:example_group][:location] = location_from(self[:example_group])
36
37
 
37
- update(extra_metadata)
38
+ update(user_metadata)
39
+ end
40
+
41
+ def ensure_valid_keys(user_metadata)
42
+ RESERVED_KEYS.each do |key|
43
+ if user_metadata.keys.include?(key)
44
+ raise <<-EOM
45
+ #{"*"*50}
46
+ :#{key} is not allowed
47
+
48
+ Rspec reserves some hash keys for its own internal use,
49
+ including :#{key}, which is used on:
50
+
51
+ #{caller(0)[4]}.
52
+
53
+ Here are all of Rspec's reserved hash keys:
54
+
55
+ #{RESERVED_KEYS.join("\n ")}
56
+ #{"*"*50}
57
+ EOM
58
+ raise ":#{key} is not allowed"
59
+ end
60
+ end
38
61
  end
39
62
 
40
63
  def for_example(description, options)
@@ -43,7 +66,7 @@ module Rspec
43
66
 
44
67
  def configure_for_example(description, options)
45
68
  store(:description, description.to_s)
46
- store(:full_description, "#{self[:example_group][:name]} #{self[:description]}")
69
+ store(:full_description, "#{self[:example_group][:full_description]} #{self[:description]}")
47
70
  store(:execution_result, {})
48
71
  store(:caller, options.delete(:caller))
49
72
  if self[:caller]
@@ -52,7 +75,6 @@ module Rspec
52
75
  end
53
76
  self[:location] = location_from(self)
54
77
  update(options)
55
- self
56
78
  end
57
79
 
58
80
  def apply_condition(filter_on, filter, metadata=nil)
@@ -83,6 +105,30 @@ module Rspec
83
105
 
84
106
  private
85
107
 
108
+ def superclass_metadata
109
+ @superclass_metadata ||= { :example_group => {} }
110
+ end
111
+
112
+ def description_from(args)
113
+ @description_from_args ||= args.map{|a| a.to_s.strip}.join(" ")
114
+ end
115
+
116
+ def full_description_from(args)
117
+ if superclass_metadata[:example_group][:full_description]
118
+ "#{superclass_metadata[:example_group][:full_description]} #{description_from(args)}"
119
+ else
120
+ description_from(args)
121
+ end
122
+ end
123
+
124
+ def described_class_from(args)
125
+ if args.first.is_a?(String)
126
+ superclass_metadata[:example_group][:describes]
127
+ else
128
+ args.first
129
+ end
130
+ end
131
+
86
132
  def file_path_from(metadata, given_file_path=nil)
87
133
  given_file_path || file_and_line_number(metadata)[0].strip
88
134
  end
@@ -103,14 +149,6 @@ module Rspec
103
149
  metadata[:caller].grep(/\_spec\.rb:/i)
104
150
  end
105
151
 
106
- def determine_name
107
- if superclass_metadata && superclass_metadata[:example_group][:name]
108
- self[:example_group][:name] = "#{superclass_metadata[:example_group][:name]} #{self[:example_group][:description]}".strip
109
- else
110
- self[:example_group][:name] = "#{self[:example_group][:describes]} #{self[:example_group][:description]}".strip
111
- end
112
- end
113
-
114
152
  end
115
153
  end
116
154
  end
@@ -0,0 +1,226 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rspec-core}
8
+ s.version = "2.0.0.beta.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Chad Humphries", "David Chelimsky"]
12
+ s.date = %q{2010-03-08}
13
+ s.description = %q{Rspec runner and example group classes}
14
+ s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
15
+ s.executables = ["rspec", "spec"]
16
+ s.extra_rdoc_files = [
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ ".treasure_map.rb",
23
+ "License.txt",
24
+ "README.markdown",
25
+ "Rakefile",
26
+ "TODO.markdown",
27
+ "Upgrade.markdown",
28
+ "VERSION",
29
+ "bin/rspec",
30
+ "bin/spec",
31
+ "cucumber.yml",
32
+ "example_specs/failing/README.txt",
33
+ "example_specs/failing/diffing_spec.rb",
34
+ "example_specs/failing/failing_implicit_docstrings_example.rb",
35
+ "example_specs/failing/failure_in_after.rb",
36
+ "example_specs/failing/failure_in_before.rb",
37
+ "example_specs/failing/mocking_example.rb",
38
+ "example_specs/failing/mocking_with_flexmock.rb",
39
+ "example_specs/failing/mocking_with_mocha.rb",
40
+ "example_specs/failing/mocking_with_rr.rb",
41
+ "example_specs/failing/partial_mock_example.rb",
42
+ "example_specs/failing/pending_example.rb",
43
+ "example_specs/failing/predicate_example.rb",
44
+ "example_specs/failing/raising_example.rb",
45
+ "example_specs/failing/spec_helper.rb",
46
+ "example_specs/failing/syntax_error_example.rb",
47
+ "example_specs/failing/team_spec.rb",
48
+ "example_specs/failing/timeout_behaviour.rb",
49
+ "example_specs/passing/custom_formatter.rb",
50
+ "example_specs/passing/custom_matchers.rb",
51
+ "example_specs/passing/dynamic_spec.rb",
52
+ "example_specs/passing/file_accessor.rb",
53
+ "example_specs/passing/file_accessor_spec.rb",
54
+ "example_specs/passing/filtered_formatter.rb",
55
+ "example_specs/passing/filtered_formatter_example.rb",
56
+ "example_specs/passing/greeter_spec.rb",
57
+ "example_specs/passing/helper_method_example.rb",
58
+ "example_specs/passing/implicit_docstrings_example.rb",
59
+ "example_specs/passing/io_processor.rb",
60
+ "example_specs/passing/io_processor_spec.rb",
61
+ "example_specs/passing/mocking_example.rb",
62
+ "example_specs/passing/multi_threaded_example_group_runner.rb",
63
+ "example_specs/passing/nested_classes_example.rb",
64
+ "example_specs/passing/options_example.rb",
65
+ "example_specs/passing/options_formatter.rb",
66
+ "example_specs/passing/partial_mock_example.rb",
67
+ "example_specs/passing/pending_example.rb",
68
+ "example_specs/passing/predicate_example.rb",
69
+ "example_specs/passing/shared_example_group_example.rb",
70
+ "example_specs/passing/shared_stack_examples.rb",
71
+ "example_specs/passing/spec_helper.rb",
72
+ "example_specs/passing/stack.rb",
73
+ "example_specs/passing/stack_spec.rb",
74
+ "example_specs/passing/stack_spec_with_nested_example_groups.rb",
75
+ "example_specs/passing/stubbing_example.rb",
76
+ "example_specs/passing/yielding_example.rb",
77
+ "example_specs/ruby1.9.compatibility/access_to_constants_spec.rb",
78
+ "example_specs/spec_helper.rb",
79
+ "features-pending/formatters/custom_formatter.feature",
80
+ "features-pending/heckle/heckle.feature",
81
+ "features-pending/interop/examples_and_tests_together.feature",
82
+ "features-pending/interop/rspec_output.feature",
83
+ "features-pending/interop/test_but_not_test_unit.feature",
84
+ "features-pending/interop/test_case_with_should_methods.feature",
85
+ "features-pending/mocks/stub_implementation.feature",
86
+ "features-pending/pending/pending_examples.feature",
87
+ "features/command_line/example_name_option.feature",
88
+ "features/command_line/line_number_appended_to_path.feature",
89
+ "features/command_line/line_number_option.feature",
90
+ "features/configuration/spec_opts.feature",
91
+ "features/example_groups/describe_aliases.feature",
92
+ "features/example_groups/nested_groups.feature",
93
+ "features/hooks/around_hook.feature",
94
+ "features/hooks/before_and_after_hooks.feature",
95
+ "features/hooks/described_class.feature",
96
+ "features/hooks/halt.feature",
97
+ "features/mock_framework_integration/use_flexmock.feature",
98
+ "features/mock_framework_integration/use_mocha.feature",
99
+ "features/mock_framework_integration/use_rr.feature",
100
+ "features/mock_framework_integration/use_rspec.feature",
101
+ "features/subject/explicit_subject.feature",
102
+ "features/subject/implicit_subject.feature",
103
+ "features/support/env.rb",
104
+ "lib/rspec/autorun.rb",
105
+ "lib/rspec/core.rb",
106
+ "lib/rspec/core/around_proxy.rb",
107
+ "lib/rspec/core/backward_compatibility.rb",
108
+ "lib/rspec/core/command_line_options.rb",
109
+ "lib/rspec/core/configuration.rb",
110
+ "lib/rspec/core/deprecation.rb",
111
+ "lib/rspec/core/example.rb",
112
+ "lib/rspec/core/example_group.rb",
113
+ "lib/rspec/core/example_group_subject.rb",
114
+ "lib/rspec/core/formatters.rb",
115
+ "lib/rspec/core/formatters/base_formatter.rb",
116
+ "lib/rspec/core/formatters/base_text_formatter.rb",
117
+ "lib/rspec/core/formatters/documentation_formatter.rb",
118
+ "lib/rspec/core/formatters/progress_formatter.rb",
119
+ "lib/rspec/core/hooks.rb",
120
+ "lib/rspec/core/kernel_extensions.rb",
121
+ "lib/rspec/core/let.rb",
122
+ "lib/rspec/core/load_path.rb",
123
+ "lib/rspec/core/metadata.rb",
124
+ "lib/rspec/core/mocking/with_absolutely_nothing.rb",
125
+ "lib/rspec/core/mocking/with_flexmock.rb",
126
+ "lib/rspec/core/mocking/with_mocha.rb",
127
+ "lib/rspec/core/mocking/with_rr.rb",
128
+ "lib/rspec/core/mocking/with_rspec.rb",
129
+ "lib/rspec/core/rake_task.rb",
130
+ "lib/rspec/core/ruby_project.rb",
131
+ "lib/rspec/core/runner.rb",
132
+ "lib/rspec/core/shared_example_group.rb",
133
+ "lib/rspec/core/shared_example_group_kernel_extensions.rb",
134
+ "lib/rspec/core/version.rb",
135
+ "lib/rspec/core/world.rb",
136
+ "rspec-core.gemspec",
137
+ "script/console",
138
+ "spec/rspec/core/command_line_options_spec.rb",
139
+ "spec/rspec/core/configuration_spec.rb",
140
+ "spec/rspec/core/example_group_spec.rb",
141
+ "spec/rspec/core/example_group_subject_spec.rb",
142
+ "spec/rspec/core/example_spec.rb",
143
+ "spec/rspec/core/formatters/base_formatter_spec.rb",
144
+ "spec/rspec/core/formatters/documentation_formatter_spec.rb",
145
+ "spec/rspec/core/formatters/progress_formatter_spec.rb",
146
+ "spec/rspec/core/kernel_extensions_spec.rb",
147
+ "spec/rspec/core/metadata_spec.rb",
148
+ "spec/rspec/core/mocha_spec.rb",
149
+ "spec/rspec/core/pending_example_spec.rb",
150
+ "spec/rspec/core/resources/a_bar.rb",
151
+ "spec/rspec/core/resources/a_foo.rb",
152
+ "spec/rspec/core/resources/a_spec.rb",
153
+ "spec/rspec/core/resources/custom_example_group_runner.rb",
154
+ "spec/rspec/core/resources/utf8_encoded.rb",
155
+ "spec/rspec/core/ruby_project_spec.rb",
156
+ "spec/rspec/core/runner_spec.rb",
157
+ "spec/rspec/core/shared_example_group_spec.rb",
158
+ "spec/rspec/core/world_spec.rb",
159
+ "spec/rspec/core_spec.rb",
160
+ "spec/ruby_forker.rb",
161
+ "spec/spec_helper.rb",
162
+ "specs.watchr"
163
+ ]
164
+ s.homepage = %q{http://github.com/rspec/core}
165
+ s.post_install_message = %q{**************************************************
166
+
167
+ Thank you for installing rspec-core-2.0.0.beta.3
168
+
169
+ This is beta software. If you are looking
170
+ for a supported production release, please
171
+ "gem install rspec" (without --pre).
172
+
173
+ **************************************************
174
+ }
175
+ s.rdoc_options = ["--charset=UTF-8"]
176
+ s.require_paths = ["lib"]
177
+ s.rubyforge_project = %q{rspec}
178
+ s.rubygems_version = %q{1.3.6}
179
+ s.summary = %q{rspec-core-2.0.0.beta.3}
180
+ s.test_files = [
181
+ "spec/rspec/core/command_line_options_spec.rb",
182
+ "spec/rspec/core/configuration_spec.rb",
183
+ "spec/rspec/core/example_group_spec.rb",
184
+ "spec/rspec/core/example_group_subject_spec.rb",
185
+ "spec/rspec/core/example_spec.rb",
186
+ "spec/rspec/core/formatters/base_formatter_spec.rb",
187
+ "spec/rspec/core/formatters/documentation_formatter_spec.rb",
188
+ "spec/rspec/core/formatters/progress_formatter_spec.rb",
189
+ "spec/rspec/core/kernel_extensions_spec.rb",
190
+ "spec/rspec/core/metadata_spec.rb",
191
+ "spec/rspec/core/mocha_spec.rb",
192
+ "spec/rspec/core/pending_example_spec.rb",
193
+ "spec/rspec/core/resources/a_bar.rb",
194
+ "spec/rspec/core/resources/a_foo.rb",
195
+ "spec/rspec/core/resources/a_spec.rb",
196
+ "spec/rspec/core/resources/custom_example_group_runner.rb",
197
+ "spec/rspec/core/resources/utf8_encoded.rb",
198
+ "spec/rspec/core/ruby_project_spec.rb",
199
+ "spec/rspec/core/runner_spec.rb",
200
+ "spec/rspec/core/shared_example_group_spec.rb",
201
+ "spec/rspec/core/world_spec.rb",
202
+ "spec/rspec/core_spec.rb",
203
+ "spec/ruby_forker.rb",
204
+ "spec/spec_helper.rb"
205
+ ]
206
+
207
+ if s.respond_to? :specification_version then
208
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
209
+ s.specification_version = 3
210
+
211
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
212
+ s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.3"])
213
+ s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.3"])
214
+ s.add_development_dependency(%q<cucumber>, [">= 0.5.3"])
215
+ else
216
+ s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.3"])
217
+ s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.3"])
218
+ s.add_dependency(%q<cucumber>, [">= 0.5.3"])
219
+ end
220
+ else
221
+ s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.3"])
222
+ s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.3"])
223
+ s.add_dependency(%q<cucumber>, [">= 0.5.3"])
224
+ end
225
+ end
226
+
@@ -26,28 +26,6 @@ module Rspec::Core
26
26
 
27
27
  end
28
28
 
29
- describe '#display_name' do
30
-
31
- it "uses the first parameter as name" do
32
- ExampleGroup.create("my favorite pony") { }.display_name.should == 'my favorite pony'
33
- end
34
-
35
- it "accepts a constant as the first parameter" do
36
- ExampleGroup.create(Object) { }.display_name.should == 'Object'
37
- end
38
-
39
- it "concats nested names" do
40
- group = ExampleGroup.create(Object, 'test') {}
41
- group.display_name.should == 'Object test'
42
-
43
- nested_group_one = group.describe('nested one') { }
44
- nested_group_one.display_name.should == 'Object test nested one'
45
-
46
- nested_group_two = nested_group_one.describe('nested two') { }
47
- nested_group_two.display_name.should == 'Object test nested one nested two'
48
- end
49
-
50
- end
51
29
 
52
30
  describe '#describes' do
53
31
 
@@ -71,12 +49,9 @@ module Rspec::Core
71
49
 
72
50
  describe '#description' do
73
51
 
74
- it "exposes the second parameter as description" do
75
- ExampleGroup.create(Object, "my desc") { }.description.should == 'my desc'
76
- end
77
-
78
- it "allows the second parameter to be nil" do
79
- ExampleGroup.create(Object, nil) { }.description.should == ""
52
+ it "grabs the description from the metadata" do
53
+ group = ExampleGroup.create(Object, "my desc") { }
54
+ group.description.should == group.metadata[:example_group][:description]
80
55
  end
81
56
 
82
57
  end
@@ -3,44 +3,79 @@ require 'spec_helper'
3
3
  module Rspec
4
4
  module Core
5
5
  describe Metadata do
6
- describe "[:example_group][:name]" do
7
- it "generates name for top level example group" do
8
- m = Metadata.new
9
- m.process("description", :caller => caller(0))
10
- m[:example_group][:name].should == "description"
11
- end
12
6
 
13
- it "concats args to describe()" do
14
- m = Metadata.new
15
- m.process(String, "with dots", :caller => caller(0))
16
- m[:example_group][:name].should == "String with dots"
17
- end
18
-
19
- it "concats nested names" do
20
- parent = Metadata.new
21
- parent.process("parent", :caller => caller(0))
22
- m = Metadata.new(parent)
23
- m.process("child", :caller => caller(0))
24
- m[:example_group][:name].should == "parent child"
7
+ describe "#process" do
8
+ Metadata::RESERVED_KEYS.each do |key|
9
+ it "prohibits :#{key} as a hash key" do
10
+ m = Metadata.new
11
+ expect do
12
+ m.process('group', key => {})
13
+ end.to raise_error(/:#{key} is not allowed/)
14
+ end
25
15
  end
16
+ end
26
17
 
27
- it "strips the name" do
18
+ describe "[:description]" do
19
+ it "just has the example description" do
28
20
  m = Metadata.new
29
- m.process(" description \n", :caller => caller(0))
30
- m[:example_group][:name].should == "description"
21
+ m.process('group')
22
+
23
+ m = m.for_example("example", {})
24
+ m[:description].should == "example"
31
25
  end
32
26
  end
33
27
 
34
28
  describe "[:full_description]" do
35
29
  it "concats the example group name and description" do
36
30
  m = Metadata.new
37
- m[:example_group][:name] = "group"
31
+ m.process('group')
38
32
 
39
33
  m = m.for_example("example", {})
40
34
  m[:full_description].should == "group example"
41
35
  end
42
36
  end
43
37
 
38
+ describe "[:example_group][:description]" do
39
+ context "with a string" do
40
+ it "provides the submitted description" do
41
+ m = Metadata.new
42
+ m.process('group')
43
+
44
+ m[:example_group][:description].should == "group"
45
+ end
46
+ end
47
+
48
+ context "with a non-string" do
49
+ it "provides the submitted description" do
50
+ m = Metadata.new
51
+ m.process('group')
52
+
53
+ m[:example_group][:description].should == "group"
54
+ end
55
+ end
56
+
57
+ context "with a non-string and a string" do
58
+ it "concats the args" do
59
+ m = Metadata.new
60
+ m.process(Object, 'group')
61
+
62
+ m[:example_group][:description].should == "Object group"
63
+ end
64
+ end
65
+ end
66
+
67
+ describe "[:example_group][:full_description]" do
68
+ it "concats the nested example group descriptions" do
69
+ parent = Metadata.new
70
+ parent.process(Object, 'parent')
71
+
72
+ child = Metadata.new(parent)
73
+ child.process('child')
74
+
75
+ child[:example_group][:full_description].should == "Object parent child"
76
+ end
77
+ end
78
+
44
79
  describe "#determine_file_path" do
45
80
  it "finds the first spec file in the caller array" do
46
81
  m = Metadata.new
@@ -80,7 +115,7 @@ module Rspec
80
115
  describe "#metadata_for_example" do
81
116
  let(:caller_for_example) { caller(0) }
82
117
  let(:line_number) { __LINE__ - 1 }
83
- let(:metadata) { Metadata.new.process("group description", :caller => caller(0)) }
118
+ let(:metadata) { Metadata.new.process("group description") }
84
119
  let(:mfe) { metadata.for_example("example description", {:caller => caller_for_example, :arbitrary => :options}) }
85
120
 
86
121
  it "stores the description" do
@@ -49,7 +49,7 @@ module Rspec::Core
49
49
  end
50
50
 
51
51
  it "finds matching groups when filtering on :description with text" do
52
- @world.apply_inclusion_filters(@example_groups, :example_group => { :description => 'find group-1' }).should == [@bg1]
52
+ @world.apply_inclusion_filters(@example_groups, :example_group => { :description => 'Bar find group-1' }).should == [@bg1]
53
53
  end
54
54
 
55
55
  it "finds matching groups when filtering on :description with a lambda" do
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 2
11
- version: 2.0.0.beta.2
10
+ - 3
11
+ version: 2.0.0.beta.3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Chad Humphries
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-03-04 00:00:00 -06:00
20
+ date: 2010-03-08 00:00:00 -06:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -32,8 +32,8 @@ dependencies:
32
32
  - 0
33
33
  - 0
34
34
  - beta
35
- - 2
36
- version: 2.0.0.beta.2
35
+ - 3
36
+ version: 2.0.0.beta.3
37
37
  type: :development
38
38
  version_requirements: *id001
39
39
  - !ruby/object:Gem::Dependency
@@ -48,8 +48,8 @@ dependencies:
48
48
  - 0
49
49
  - 0
50
50
  - beta
51
- - 2
52
- version: 2.0.0.beta.2
51
+ - 3
52
+ version: 2.0.0.beta.3
53
53
  type: :development
54
54
  version_requirements: *id002
55
55
  - !ruby/object:Gem::Dependency
@@ -135,22 +135,14 @@ files:
135
135
  - example_specs/passing/yielding_example.rb
136
136
  - example_specs/ruby1.9.compatibility/access_to_constants_spec.rb
137
137
  - example_specs/spec_helper.rb
138
- - features-pending/example_groups/example_group_with_should_methods.feature
139
- - features-pending/example_groups/implicit_docstrings.feature
140
- - features-pending/expectations/expect_change.feature
141
- - features-pending/expectations/expect_error.feature
142
- - features-pending/extensions/custom_example_group.feature
143
138
  - features-pending/formatters/custom_formatter.feature
144
139
  - features-pending/heckle/heckle.feature
145
140
  - features-pending/interop/examples_and_tests_together.feature
146
141
  - features-pending/interop/rspec_output.feature
147
142
  - features-pending/interop/test_but_not_test_unit.feature
148
143
  - features-pending/interop/test_case_with_should_methods.feature
149
- - features-pending/matchers/define_diffable_matcher.feature
150
- - features-pending/matchers/define_matcher_with_fluent_interface.feature
151
144
  - features-pending/mocks/stub_implementation.feature
152
145
  - features-pending/pending/pending_examples.feature
153
- - features-pending/runner/specify_line_number.feature
154
146
  - features/command_line/example_name_option.feature
155
147
  - features/command_line/line_number_appended_to_path.feature
156
148
  - features/command_line/line_number_option.feature
@@ -200,6 +192,7 @@ files:
200
192
  - lib/rspec/core/shared_example_group_kernel_extensions.rb
201
193
  - lib/rspec/core/version.rb
202
194
  - lib/rspec/core/world.rb
195
+ - rspec-core.gemspec
203
196
  - script/console
204
197
  - spec/rspec/core/command_line_options_spec.rb
205
198
  - spec/rspec/core/configuration_spec.rb
@@ -233,7 +226,7 @@ licenses: []
233
226
  post_install_message: |
234
227
  **************************************************
235
228
 
236
- Thank you for installing rspec-core-2.0.0.beta.2
229
+ Thank you for installing rspec-core-2.0.0.beta.3
237
230
 
238
231
  This is beta software. If you are looking
239
232
  for a supported production release, please
@@ -267,7 +260,7 @@ rubyforge_project: rspec
267
260
  rubygems_version: 1.3.6
268
261
  signing_key:
269
262
  specification_version: 3
270
- summary: rspec-core-2.0.0.beta.2
263
+ summary: rspec-core-2.0.0.beta.3
271
264
  test_files:
272
265
  - spec/rspec/core/command_line_options_spec.rb
273
266
  - spec/rspec/core/configuration_spec.rb
@@ -1,31 +0,0 @@
1
- Feature: Spec::ExampleGroup with should methods
2
-
3
- As an RSpec adopter accustomed to classes and methods
4
- I want to use should_* methods in an ExampleGroup
5
- So that I use RSpec with classes and methods that look more like RSpec examples
6
-
7
- Scenario Outline: Example Group class with should methods
8
- Given a file named "example_group_with_should_methods.rb" with:
9
- """
10
- require 'rspec/autorun'
11
- require 'rspec/expectations'
12
- Rspec::Core::ExampleGroup.send(:include, Rspec::Matchers)
13
-
14
- class MySpec < Rspec::Core::ExampleGroup
15
- def should_pass_with_should
16
- 1.should == 1
17
- end
18
-
19
- def should_fail_with_should
20
- 1.should == 2
21
- end
22
- end
23
- """
24
- When I run "<Command> example_group_with_should_methods.rb"
25
- Then the exit code should be 256
26
- And the stdout should match "2 examples, 1 failure"
27
-
28
- Scenarios: Run with ruby and spec
29
- | Command |
30
- | ruby |
31
- | spec |
@@ -1,59 +0,0 @@
1
- Feature: implicit docstrings
2
-
3
- As an RSpec user
4
- I want examples to generate their own names
5
- So that I can reduce duplication between example names and example code
6
-
7
- Scenario Outline: run passing examples
8
- Given a file named "implicit_docstrings_example.rb" with:
9
- """
10
- require 'rspec/autorun'
11
- describe "Examples with no docstrings generate their own:" do
12
-
13
- specify { 3.should be < 5 }
14
-
15
- specify { ["a"].should include("a") }
16
-
17
- specify { [1,2,3].should respond_to(:size) }
18
-
19
- end
20
- """
21
-
22
- When I run "<Command> implicit_docstrings_example.rb -fs"
23
-
24
- Then the stdout should match /should be < 5/
25
- And the stdout should match /should include "a"/
26
- And the stdout should match /should respond to #size/
27
-
28
- Scenarios: Run with ruby and spec
29
- | Command |
30
- | ruby |
31
- | spec |
32
-
33
- Scenario Outline: run failing examples
34
- Given a file named "failing_implicit_docstrings_example.rb" with:
35
- """
36
- require 'rspec/autorun'
37
- describe "Failing examples with no descriptions" do
38
-
39
- # description is auto-generated as "should equal(5)" based on the last #should
40
- it do
41
- 3.should equal(2)
42
- 5.should equal(5)
43
- end
44
-
45
- it { 3.should be > 5 }
46
-
47
- it { ["a"].should include("b") }
48
-
49
- it { [1,2,3].should_not respond_to(:size) }
50
-
51
- end
52
- """
53
-
54
- When I run "<Command> failing_implicit_docstrings_example.rb -fs"
55
-
56
- Then the stdout should match /should equal 2/
57
- And the stdout should match /should be > 5/
58
- And the stdout should match /should include "b"/
59
- And the stdout should match /should not respond to #size/
@@ -1,65 +0,0 @@
1
- Feature: expect change
2
-
3
- Expect some code (wrapped in a proc) to change the state of some object.
4
-
5
- Scenario: expecting change
6
- Given a file named "expect_change.rb" with:
7
- """
8
- class Counter
9
- class << self
10
- def increment
11
- @count ||= 0
12
- @count += 1
13
- end
14
-
15
- def count
16
- @count ||= 0
17
- end
18
- end
19
- end
20
-
21
- describe Counter, "#increment" do
22
- it "should increment the count" do
23
- expect{Counter.increment}.to change{Counter.count}.from(0).to(1)
24
- end
25
-
26
- # deliberate failure
27
- it "should increment the count by 2" do
28
- expect{Counter.increment}.to change{Counter.count}.by(2)
29
- end
30
- end
31
- """
32
- When I run "spec expect_change.rb"
33
- Then the stdout should match "2 examples, 1 failure"
34
- Then the stdout should match "should have been changed by 2, but was changed by 1"
35
-
36
- Scenario: expecting no change
37
- Given a file named "expect_no_change.rb" with:
38
- """
39
- class Counter
40
- class << self
41
- def increment
42
- @count ||= 0
43
- @count += 1
44
- end
45
-
46
- def count
47
- @count ||= 0
48
- end
49
- end
50
- end
51
-
52
- describe Counter, "#increment" do
53
- it "should not increment the count by 2" do
54
- expect{Counter.increment}.to_not change{Counter.count}.from(0).to(2)
55
- end
56
-
57
- # deliberate failure
58
- it "should not increment the count by 1" do
59
- expect{Counter.increment}.to_not change{Counter.count}.by(1)
60
- end
61
- end
62
- """
63
- When I run "spec expect_no_change.rb"
64
- Then the stdout should match "2 examples, 1 failure"
65
- Then the stdout should match "should not have changed, but did change from 1 to 2"
@@ -1,44 +0,0 @@
1
- Feature: expect error
2
-
3
- Expect a proc to change the state of some object.
4
-
5
- Scenario: expect error
6
- Given a file named "expect_error.rb" with:
7
- """
8
- describe Object, "#non_existent_message" do
9
- it "should raise" do
10
- expect{Object.non_existent_message}.to raise_error(NameError)
11
- end
12
- end
13
-
14
- #deliberate failure
15
- describe Object, "#public_instance_methods" do
16
- it "should raise" do
17
- expect{Object.public_instance_methods}.to raise_error(NameError)
18
- end
19
- end
20
- """
21
- When I run "spec expect_error.rb"
22
- Then the stdout should match "2 examples, 1 failure"
23
- Then the stdout should match "expected NameError but nothing was raised"
24
-
25
- Scenario: expect no error
26
- Given a file named "expect_no_error.rb" with:
27
- """
28
- describe Object, "#public_instance_methods" do
29
- it "should not raise" do
30
- expect{Object.public_instance_methods}.to_not raise_error(NameError)
31
- end
32
- end
33
-
34
- #deliberate failure
35
- describe Object, "#non_existent_message" do
36
- it "should not raise" do
37
- expect{Object.non_existent_message}.to_not raise_error(NameError)
38
- end
39
- end
40
- """
41
- When I run "spec expect_no_error.rb"
42
- Then the stdout should match "2 examples, 1 failure"
43
- Then the stdout should match "undefined method `non_existent_message'"
44
-
@@ -1,19 +0,0 @@
1
- Feature: custom example group
2
-
3
- Scenario: simple custom example group
4
- Given a file named "custom_example_group_spec.rb" with:
5
- """
6
- class CustomGroup < Spec::ExampleGroup
7
- end
8
-
9
- Spec::Example::ExampleGroupFactory.default(CustomGroup)
10
-
11
- describe "setting a default example group base class" do
12
- it "should use that class by default" do
13
- CustomGroup.should === self
14
- end
15
- end
16
- """
17
- When I run "spec custom_example_group_spec.rb"
18
- Then the stdout should match "1 example, 0 failures"
19
-
@@ -1,26 +0,0 @@
1
- Feature: define diffable matcher
2
-
3
- When a matcher is defined as diffable, and the --diff
4
- flag is set, the output will include a diff of the submitted
5
- objects.
6
-
7
- Scenario: define a diffable matcher
8
- Given a file named "diffable_matcher_spec.rb" with:
9
- """
10
- Rspec::Matchers.define :be_just_like do |expected|
11
- match do |actual|
12
- actual == expected
13
- end
14
-
15
- diffable
16
- end
17
-
18
- describe "this" do
19
- it {should be_just_like("that")}
20
- end
21
- """
22
- When I run "spec diffable_matcher_spec.rb --diff"
23
- Then the exit code should be 256
24
-
25
- And the stdout should match "should be just like \"that\""
26
- And the stdout should match "Diff:\n@@ -1,2 +1,2 @@\n-that\n+this"
@@ -1,27 +0,0 @@
1
- Feature: define matcher
2
-
3
- In order to express my domain clearly in my code examples
4
- As an RSpec user
5
- I want to define matchers with fluent interfaces
6
-
7
- Scenario: one additional method
8
- Given a file named "between_spec.rb" with:
9
- """
10
- Rspec::Matchers.define :be_bigger_than do |first|
11
- def but_smaller_than(second)
12
- @second = second
13
- self
14
- end
15
-
16
- match do |actual|
17
- (actual > first) && (actual < @second)
18
- end
19
- end
20
-
21
- describe 5 do
22
- it { should be_bigger_than(4).but_smaller_than(6) }
23
- end
24
- """
25
- When I run "spec between_spec.rb --format specdoc"
26
- Then the stdout should match "1 example, 0 failures"
27
- And the stdout should match "should be bigger than 4"
@@ -1,32 +0,0 @@
1
- Feature: run specific examples by line number
2
-
3
- In order to run a single example from command line
4
- RSpec allows you to specify the line number of the example(s) to run
5
-
6
- Scenario: --line syntax on single example
7
- Given a file named "example_spec.rb" with:
8
- """
9
- describe "an example" do
10
- it "has not yet been implemented"
11
- it "has been implemented" do
12
- true
13
- end
14
- end
15
- """
16
- When I run "spec example_spec.rb --line 2"
17
- Then the stdout should match "1 example, 0 failures, 1 pending"
18
- And the stdout should match "example_spec.rb:2"
19
-
20
- Scenario: colon line syntax on single example
21
- Given a file named "example_spec.rb" with:
22
- """
23
- describe "an example" do
24
- it "has not yet been implemented"
25
- it "has been implemented" do
26
- true
27
- end
28
- end
29
- """
30
- When I run "spec example_spec.rb:2"
31
- Then the stdout should match "1 example, 0 failures, 1 pending"
32
- And the stdout should match "example_spec.rb:2"