rspec 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +35 -0
- data/MIT-LICENSE +1 -1
- data/README +9 -44
- data/Rakefile +34 -51
- data/TODO +0 -1
- data/UPGRADE +0 -24
- data/bin/spec +0 -0
- data/bin/spec_translator +0 -0
- data/examples/pure/behave_as_example.rb +0 -0
- data/examples/pure/partial_mock_example.rb +1 -0
- data/examples/stories/calculator.rb +1 -1
- data/lib/autotest/rspec.rb +7 -9
- data/lib/spec/example.rb +1 -1
- data/lib/spec/example/configuration.rb +30 -16
- data/lib/spec/example/example_group.rb +2 -1
- data/lib/spec/example/example_group_factory.rb +23 -21
- data/lib/spec/example/example_group_methods.rb +18 -5
- data/lib/spec/example/example_matcher.rb +0 -0
- data/lib/spec/example/example_methods.rb +6 -0
- data/lib/spec/example/module_inclusion_warnings.rb +37 -0
- data/lib/spec/expectations/differs/default.rb +1 -1
- data/lib/spec/expectations/extensions/object.rb +4 -12
- data/lib/spec/expectations/handler.rb +8 -0
- data/lib/spec/extensions.rb +1 -0
- data/lib/spec/extensions/metaclass.rb +7 -0
- data/lib/spec/extensions/object.rb +0 -4
- data/lib/spec/matchers/change.rb +1 -1
- data/lib/spec/matchers/has.rb +1 -11
- data/lib/spec/matchers/operator_matcher.rb +0 -0
- data/lib/spec/matchers/raise_error.rb +53 -30
- data/lib/spec/mocks.rb +1 -1
- data/lib/spec/mocks/argument_constraint_matchers.rb +5 -1
- data/lib/spec/mocks/argument_expectation.rb +26 -0
- data/lib/spec/mocks/extensions.rb +1 -0
- data/lib/spec/mocks/framework.rb +15 -0
- data/lib/spec/mocks/message_expectation.rb +29 -5
- data/lib/spec/mocks/mock.rb +9 -7
- data/lib/spec/mocks/proxy.rb +26 -12
- data/lib/spec/rake/spectask.rb +5 -5
- data/lib/spec/runner/backtrace_tweaker.rb +1 -1
- data/lib/spec/runner/formatter/base_formatter.rb +2 -3
- data/lib/spec/runner/formatter/base_text_formatter.rb +2 -2
- data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +4 -8
- data/lib/spec/runner/formatter/html_formatter.rb +18 -14
- data/lib/spec/runner/formatter/nested_text_formatter.rb +65 -0
- data/lib/spec/runner/formatter/profile_formatter.rb +4 -0
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +5 -1
- data/lib/spec/runner/formatter/specdoc_formatter.rb +1 -1
- data/lib/spec/runner/formatter/story/plain_text_formatter.rb +18 -7
- data/lib/spec/runner/option_parser.rb +17 -15
- data/lib/spec/runner/options.rb +37 -14
- data/lib/spec/runner/reporter.rb +15 -11
- data/lib/spec/story/extensions/regexp.rb +2 -2
- data/lib/spec/story/extensions/string.rb +2 -2
- data/lib/spec/story/runner.rb +9 -5
- data/lib/spec/story/runner/plain_text_story_runner.rb +2 -2
- data/lib/spec/story/runner/scenario_runner.rb +8 -0
- data/lib/spec/story/runner/story_mediator.rb +1 -1
- data/lib/spec/story/runner/story_runner.rb +3 -1
- data/lib/spec/story/step.rb +4 -4
- data/lib/spec/story/story.rb +8 -11
- data/lib/spec/story/world.rb +0 -1
- data/lib/spec/version.rb +2 -2
- data/plugins/mock_frameworks/rspec.rb +2 -0
- data/spec/autotest/rspec_spec.rb +12 -10
- data/spec/spec/example/configuration_spec.rb +0 -0
- data/spec/spec/example/example_group/described_module_spec.rb +20 -0
- data/spec/spec/example/example_group/warning_messages_spec.rb +76 -0
- data/spec/spec/example/example_group_factory_spec.rb +117 -102
- data/spec/spec/example/example_group_methods_spec.rb +51 -17
- data/spec/spec/example/example_group_spec.rb +13 -1
- data/spec/spec/example/example_methods_spec.rb +28 -6
- data/spec/spec/example/nested_example_group_spec.rb +12 -0
- data/spec/spec/example/predicate_matcher_spec.rb +0 -0
- data/spec/spec/expectations/differs/default_spec.rb +27 -9
- data/spec/spec/matchers/be_spec.rb +24 -0
- data/spec/spec/matchers/has_spec.rb +16 -0
- data/spec/spec/matchers/raise_error_spec.rb +124 -0
- data/spec/spec/mocks/{bug_report_10263.rb → bug_report_10263_spec.rb} +0 -0
- data/spec/spec/mocks/bug_report_11545_spec.rb +2 -0
- data/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +8 -0
- data/spec/spec/mocks/hash_including_matcher_spec.rb +32 -0
- data/spec/spec/mocks/mock_spec.rb +56 -37
- data/spec/spec/mocks/partial_mock_spec.rb +41 -5
- data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +6 -0
- data/spec/spec/runner/execution_context_spec.rb +7 -1
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +3 -2
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +30 -25
- data/spec/spec/runner/formatter/html_formatter_spec.rb +0 -3
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +333 -0
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +12 -2
- data/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +110 -78
- data/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +105 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +33 -28
- data/spec/spec/runner/option_parser_spec.rb +65 -49
- data/spec/spec/runner/options_spec.rb +103 -17
- data/spec/spec/runner/reporter_spec.rb +10 -7
- data/spec/spec/runner/spec_drb.opts +1 -0
- data/spec/spec/runner/spec_parser_spec.rb +10 -4
- data/spec/spec/story/runner/plain_text_story_runner_spec.rb +14 -13
- data/spec/spec/story/runner/scenario_runner_spec.rb +124 -52
- data/spec/spec/story/runner/story_mediator_spec.rb +2 -2
- data/spec/spec/story/runner/story_runner_spec.rb +40 -2
- data/spec/spec/story/runner_spec.rb +59 -72
- data/spec/spec/story/step_spec.rb +20 -1
- data/spec/spec/story/story_spec.rb +2 -2
- data/stories/all.rb +1 -1
- data/stories/example_groups/stories.rb +4 -3
- data/stories/mock_framework_integration/stories.rb +7 -0
- data/stories/mock_framework_integration/use_flexmock.story +9 -0
- data/stories/resources/spec/spec_with_flexmock.rb +18 -0
- metadata +21 -18
- data/pre_commit/lib/pre_commit.rb +0 -4
- data/pre_commit/lib/pre_commit/core.rb +0 -50
- data/pre_commit/lib/pre_commit/pre_commit.rb +0 -54
- data/pre_commit/lib/pre_commit/rspec.rb +0 -111
- data/pre_commit/lib/pre_commit/rspec_on_rails.rb +0 -313
- data/pre_commit/spec/pre_commit/pre_commit_spec.rb +0 -15
- data/pre_commit/spec/pre_commit/rspec_on_rails_spec.rb +0 -36
- data/pre_commit/spec/spec_helper.rb +0 -3
- data/pre_commit/spec/spec_suite.rb +0 -11
data/CHANGES
CHANGED
@@ -1,6 +1,40 @@
|
|
1
|
+
== Version 1.1.4
|
2
|
+
|
3
|
+
Maintenance release.
|
4
|
+
|
5
|
+
Note: we've removed the metaclass method from Object. There were some
|
6
|
+
generated specs that used it, and they will now break. Just replace the
|
7
|
+
metaclass call with (class << self; self; end) and all will be well.
|
8
|
+
|
9
|
+
* pending steps print out yellow in stories (patch from Kyle Hargraves)
|
10
|
+
* Deprecation warnings for specs that assume auto-inclusion of modules. Closes #326 (patch from Scott Taylor)
|
11
|
+
* mock.should_not_receive(:anything) fails fast (once again)
|
12
|
+
* Patch from Antti Tarvainen to stop files from being loaded repeatedly when running heckle. Closes #333.
|
13
|
+
* Fixed bug in which session object in example was not the same instance used in the controller. Closes #331.
|
14
|
+
* Applied patch from Antti Tarvainen to fix bug where heckle runs rspec runs heckle runs rspec etc. Closes #280.
|
15
|
+
* Applied patch from Zach Dennis to merge :steps functionality to :steps_for. Closes #324.
|
16
|
+
* Applied patch from Ryan Davis to add eval of block passed to raise_error matcher. Closes #321.
|
17
|
+
* alias :context :describe in example_group_methods. Closes #312.
|
18
|
+
* Applied patch from Ben Mabey to make the Story runner exit with a non-0 exit code on failing stories. Closes #228.
|
19
|
+
* Applied patch from Coda Hale to get the :red hook called in autotest. Closes #279.
|
20
|
+
* Applied patch from Patrick Ritchie to support --drb in spec.opts. Closes #274, #293.
|
21
|
+
* Moved metaclass method from Object to an internal module which gets included where it is needed.
|
22
|
+
* Applied patch from Dayo Esho: and_yield clobbers return value from block. Closes #217.
|
23
|
+
* Applied patch from Bob Cotton: ExampleGroupFactory.default resets previously registered types. Closes #222.
|
24
|
+
* Applied patch from Mike Williams to support the lib directory in rails apps with the Textmate Alternate File command. Closes #276.
|
25
|
+
* ExampleGroupMethods#xspecify aliases #xit
|
26
|
+
* A SharedExampleGroup can be created within another ExampleGroup.
|
27
|
+
* Applied patch from Bob Cotton: Nested ExampleGroups do not have a spec_path. Closes #224.
|
28
|
+
* Add before_suite and after_suite callbacks to ExampleGroupMethods and Options. Closes #210.
|
29
|
+
* The after(:suite) callback lambda is passed a boolean representing whether the suite passed or failed
|
30
|
+
* Added NestedTextFormatter. Closes #366.
|
31
|
+
* decoupled mock framework from global extensions used by rspec - supports use of flexmock or mocha w/ rails
|
32
|
+
* Applied patch from Roman Chernyatchik to allow the user to pass in the rails version into spectask. Closes #325, #370
|
33
|
+
|
1
34
|
== Version 1.1.3
|
2
35
|
|
3
36
|
Maintenance release.
|
37
|
+
Notice to autotest users: you must also upgrade to ZenTest-3.9.0.
|
4
38
|
|
5
39
|
* Tightened up exceptions list in autotest/rails_spec. Closes #264.
|
6
40
|
* Applied patch from Ryan Davis for ZenTest-3.9.0 compatibility
|
@@ -18,6 +52,7 @@ Maintenance release.
|
|
18
52
|
== Version 1.1.2
|
19
53
|
|
20
54
|
Minor bug fixes/enhancements.
|
55
|
+
Notice to autotest users: you must also upgrade to ZenTest-3.8.0.
|
21
56
|
|
22
57
|
* RSpec's Autotest subclasses compatible with ZenTest-3.8.0 (thanks to Ryan Davis for making it easier on Autotest subs).
|
23
58
|
* Applied patch from idl to add spec/lib to rake stats. Closes #226.
|
data/MIT-LICENSE
CHANGED
data/README
CHANGED
@@ -5,9 +5,9 @@ with Executable Scenarios and Executable Examples at the code level.
|
|
5
5
|
|
6
6
|
RSpec ships with several modules:
|
7
7
|
|
8
|
-
Spec::Story provides a framework for expressing User Stories
|
8
|
+
Spec::Story provides a framework for expressing User Stories and Scenarios
|
9
9
|
|
10
|
-
Spec::Example provides a framework for expressing
|
10
|
+
Spec::Example provides a framework for expressing Isolated Examples
|
11
11
|
|
12
12
|
Spec::Matchers provides Expression Matchers for use with Spec::Expectations
|
13
13
|
and Spec::Mocks.
|
@@ -22,50 +22,15 @@ behaviour to your existing objects.
|
|
22
22
|
|
23
23
|
== Installation
|
24
24
|
|
25
|
-
The simplest approach is to install the gem:
|
25
|
+
The simplest approach is to install the gem (as root in some environments):
|
26
26
|
|
27
|
-
gem install -r rspec
|
27
|
+
gem install -r rspec
|
28
28
|
|
29
29
|
== Building the RSpec gem
|
30
|
-
If you prefer to build the gem locally, check out source from svn://rubyforge.org/var/svn/rspec/trunk. Then
|
31
|
-
do the following:
|
32
30
|
|
33
|
-
|
34
|
-
gem install pkg/rspec-0.x.x.gem (you may have to sudo)
|
35
|
-
|
36
|
-
== Running RSpec's specs
|
37
|
-
In order to run RSpec's full suite of specs (rake pre_commit) you must install the following gems:
|
38
|
-
|
39
|
-
* rake # Runs the build script
|
40
|
-
* rcov # Verifies that the code is 100% covered by specs
|
41
|
-
* webby # Generates the static HTML website
|
42
|
-
* syntax # Required to highlight ruby code
|
43
|
-
* diff-lcs # Required if you use the --diff switch
|
44
|
-
* win32console # Required by the --colour switch if you're on Windows
|
45
|
-
* meta_project # Required in order to make releases at RubyForge
|
46
|
-
* heckle # Required if you use the --heckle switch
|
47
|
-
* hpricot # Used for parsing HTML from the HTML output formatter in RSpec's own specs
|
48
|
-
|
49
|
-
Once those are all installed, you should be able to run the suite with the following steps:
|
50
|
-
|
51
|
-
* svn co svn://rubyforge.org/var/svn/rspec/trunk rspec
|
52
|
-
* cd rspec
|
53
|
-
* rake install_dependencies
|
54
|
-
* cd example_rails_app
|
55
|
-
* export RSPEC_RAILS_VERSION=1.2.3
|
56
|
-
* rake rspec:generate_mysql_config
|
57
|
-
* mysql -u root < db/mysql_setup.sql
|
58
|
-
* cd ..
|
59
|
-
* rake pre_commit
|
60
|
-
|
61
|
-
Note that RSpec itself - once built - doesn't have any dependencies outside the Ruby core
|
62
|
-
and stdlib - with a few exceptions:
|
63
|
-
|
64
|
-
* The spec command line uses diff-lcs when --diff is specified.
|
65
|
-
* The spec command line uses heckle when --heckle is specified.
|
66
|
-
* The Spec::Rake::SpecTask needs RCov if RCov is enabled in the task.
|
67
|
-
|
68
|
-
See http://rspec.rubyforge.org for further documentation.
|
69
|
-
|
70
|
-
== Contributing
|
31
|
+
If you prefer to build the gem locally:
|
71
32
|
|
33
|
+
git clone git://github.com/dchelimsky/rspec.git
|
34
|
+
cd rspec
|
35
|
+
rake gem
|
36
|
+
gem install pkg/rspec-0.x.x.gem #as root
|
data/Rakefile
CHANGED
@@ -7,8 +7,6 @@ require 'rake/rdoctask'
|
|
7
7
|
require 'rake/testtask'
|
8
8
|
require 'spec/version'
|
9
9
|
dir = File.dirname(__FILE__)
|
10
|
-
$LOAD_PATH.unshift(File.expand_path("#{dir}/pre_commit/lib"))
|
11
|
-
require "pre_commit"
|
12
10
|
|
13
11
|
# Some of the tasks are in separate files since they are also part of the website documentation
|
14
12
|
load File.dirname(__FILE__) + '/rake_tasks/examples.rake'
|
@@ -27,7 +25,6 @@ PKG_FILES = FileList[
|
|
27
25
|
'failing_examples/**/*',
|
28
26
|
'plugins/**/*',
|
29
27
|
'stories/**/*',
|
30
|
-
'pre_commit/**/*',
|
31
28
|
'rake_tasks/**/*'
|
32
29
|
]
|
33
30
|
|
@@ -56,8 +53,8 @@ end
|
|
56
53
|
|
57
54
|
desc "Run all specs and store html output in doc/output/report.html"
|
58
55
|
Spec::Rake::SpecTask.new('spec_html') do |t|
|
59
|
-
t.spec_files = FileList['spec/**/*_spec.rb'
|
60
|
-
t.spec_opts = ['--format html
|
56
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
57
|
+
t.spec_opts = ['--format html:../../../../doc/output/report.html', '--format progress','--backtrace']
|
61
58
|
end
|
62
59
|
|
63
60
|
desc "Run all failing examples"
|
@@ -124,48 +121,36 @@ task :todo do
|
|
124
121
|
egrep /(FIXME|TODO|TBD)/
|
125
122
|
end
|
126
123
|
|
127
|
-
task :
|
128
|
-
core.clobber
|
129
|
-
end
|
130
|
-
|
131
|
-
task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_news]
|
124
|
+
task :release => [:verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_news]
|
132
125
|
|
133
126
|
desc "Verifies that there is no uncommitted code"
|
134
127
|
task :verify_committed do
|
135
|
-
IO.popen('
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
end
|
128
|
+
# IO.popen('git status') do |io|
|
129
|
+
# io.each_line do |line|
|
130
|
+
# raise "\n!!! Do a git commit first !!!\n\n" if line =~ /^#\s*modified:/
|
131
|
+
# end
|
132
|
+
# end
|
140
133
|
end
|
141
134
|
|
142
135
|
desc "Creates a tag in svn"
|
143
136
|
task :tag do
|
144
|
-
from = `svn info #{File.dirname(__FILE__)}`.match(/URL: (.*)\/rspec/n)[1]
|
145
|
-
to = from.gsub(/trunk/, "tags/#{Spec::VERSION::TAG}")
|
146
|
-
current = from.gsub(/trunk/, "tags/CURRENT")
|
147
|
-
|
148
|
-
puts "Creating tag in SVN"
|
149
|
-
tag_cmd = "svn cp #{from} #{to} -m \"Tag release #{Spec::VERSION::FULL_VERSION}\""
|
150
|
-
`#{tag_cmd}` ; raise "ERROR: #{tag_cmd}" unless $? == 0
|
151
|
-
|
152
|
-
puts "Removing CURRENT"
|
153
|
-
remove_current_cmd = "svn rm #{current} -m \"Remove tags/CURRENT\""
|
154
|
-
`#{remove_current_cmd}` ; raise "ERROR: #{remove_current_cmd}" unless $? == 0
|
155
|
-
|
156
|
-
puts "Re-Creating CURRENT"
|
157
|
-
create_current_cmd = "svn cp #{to} #{current} -m \"Copy #{Spec::VERSION::TAG} to tags/CURRENT\""
|
158
|
-
`#{create_current_cmd}` ; "ERROR: #{create_current_cmd}" unless $? == 0
|
137
|
+
# from = `svn info #{File.dirname(__FILE__)}`.match(/URL: (.*)\/rspec/n)[1]
|
138
|
+
# to = from.gsub(/trunk/, "tags/#{Spec::VERSION::TAG}")
|
139
|
+
# current = from.gsub(/trunk/, "tags/CURRENT")
|
140
|
+
#
|
141
|
+
# puts "Creating tag in SVN"
|
142
|
+
# tag_cmd = "svn cp #{from} #{to} -m \"Tag release #{Spec::VERSION::FULL_VERSION}\""
|
143
|
+
# `#{tag_cmd}` ; raise "ERROR: #{tag_cmd}" unless $? == 0
|
144
|
+
#
|
145
|
+
# puts "Removing CURRENT"
|
146
|
+
# remove_current_cmd = "svn rm #{current} -m \"Remove tags/CURRENT\""
|
147
|
+
# `#{remove_current_cmd}` ; raise "ERROR: #{remove_current_cmd}" unless $? == 0
|
148
|
+
#
|
149
|
+
# puts "Re-Creating CURRENT"
|
150
|
+
# create_current_cmd = "svn cp #{to} #{current} -m \"Copy #{Spec::VERSION::TAG} to tags/CURRENT\""
|
151
|
+
# `#{create_current_cmd}` ; "ERROR: #{create_current_cmd}" unless $? == 0
|
159
152
|
end
|
160
153
|
|
161
|
-
desc "Run this task before you commit. You should see 'OK TO COMMIT'"
|
162
|
-
task(:pre_commit) {core.pre_commit}
|
163
|
-
|
164
|
-
desc "Build the website, but do not publish it"
|
165
|
-
task(:website) {core.website}
|
166
|
-
|
167
|
-
task(:rdoc_rails) {core.rdoc_rails}
|
168
|
-
|
169
154
|
task :verify_user do
|
170
155
|
raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
|
171
156
|
end
|
@@ -197,10 +182,11 @@ end
|
|
197
182
|
desc "Package the Rails plugin"
|
198
183
|
task :package_rspec_on_rails do
|
199
184
|
mkdir 'pkg' rescue nil
|
200
|
-
rm_rf
|
201
|
-
`
|
185
|
+
rm_rf "pkg/rspec-rails-#{PKG_VERSION}" rescue nil
|
186
|
+
`git clone ../rspec-rails pkg/rspec-rails-#{PKG_VERSION}`
|
187
|
+
rm_rf "pkg/rspec-rails-#{PKG_VERSION}/.git"
|
202
188
|
Dir.chdir 'pkg' do
|
203
|
-
`tar cvzf
|
189
|
+
`tar cvzf rspec-rails-#{PKG_VERSION}.tgz rspec-rails-#{PKG_VERSION}`
|
204
190
|
end
|
205
191
|
end
|
206
192
|
task :pkg => :package_rspec_on_rails
|
@@ -208,20 +194,21 @@ task :pkg => :package_rspec_on_rails
|
|
208
194
|
desc "Package the RSpec.tmbundle"
|
209
195
|
task :package_tmbundle do
|
210
196
|
mkdir 'pkg' rescue nil
|
211
|
-
rm_rf
|
212
|
-
`
|
197
|
+
rm_rf "pkg/RSpec-#{PKG_VERSION}.tmbundle" rescue nil
|
198
|
+
`git clone ../../../../RSpec.tmbundle pkg/RSpec-#{PKG_VERSION}.tmbundle`
|
199
|
+
rm_rf "pkg/RSpec-#{PKG_VERSION}.tmbundle/.git"
|
213
200
|
Dir.chdir 'pkg' do
|
214
|
-
`tar cvzf RSpec-#{PKG_VERSION}.tmbundle.tgz RSpec.tmbundle`
|
201
|
+
`tar cvzf RSpec-#{PKG_VERSION}.tmbundle.tgz RSpec-#{PKG_VERSION}.tmbundle`
|
215
202
|
end
|
216
203
|
end
|
217
204
|
task :pkg => :package_tmbundle
|
218
205
|
|
219
206
|
desc "Publish gem+tgz+zip on RubyForge. You must make sure lib/version.rb is aligned with the CHANGELOG file"
|
220
|
-
task :publish_packages => [:verify_user, :package] do
|
207
|
+
task :publish_packages => [:verify_user, :package, :pkg] do
|
221
208
|
release_files = FileList[
|
222
209
|
"pkg/#{PKG_FILE_NAME}.gem",
|
223
210
|
"pkg/#{PKG_FILE_NAME}.tgz",
|
224
|
-
"pkg/
|
211
|
+
"pkg/rspec-rails-#{PKG_VERSION}.tgz",
|
225
212
|
"pkg/#{PKG_FILE_NAME}.zip",
|
226
213
|
"pkg/RSpec-#{PKG_VERSION}.tmbundle.tgz"
|
227
214
|
]
|
@@ -272,8 +259,4 @@ task :publish_news => [:verify_user] do
|
|
272
259
|
else
|
273
260
|
puts "** Not publishing news to RubyForge - this is a prerelease"
|
274
261
|
end
|
275
|
-
end
|
276
|
-
|
277
|
-
def core
|
278
|
-
PreCommit::Core.new(self)
|
279
|
-
end
|
262
|
+
end
|
data/UPGRADE
CHANGED
@@ -1,29 +1,5 @@
|
|
1
|
-
= Upgrading existing code to RSpec-0.9
|
2
|
-
|
3
|
-
== General (see below for Spec::Rails specifics)
|
4
|
-
|
5
|
-
=== New Syntax for should and should_not
|
6
|
-
|
7
|
-
* Use translator (should get 90% of your code)
|
8
|
-
* Manually fix "parenthesis" warnings
|
9
|
-
|
10
|
-
=== Change before_context_eval to before_eval
|
11
|
-
|
12
|
-
before_context_eval is an un-published hook used by
|
13
|
-
Spec::Rails to create specialized behaviour contexts.
|
14
|
-
Most of you don't need to change this, but for those
|
15
|
-
who have exploited it, you'll need to change it to
|
16
|
-
before_eval.
|
17
|
-
|
18
1
|
== Spec::Rails
|
19
2
|
|
20
|
-
=== spec_helper.rb
|
21
|
-
|
22
|
-
We've added a new way to configure Spec::Runner to do
|
23
|
-
things like use_transactional_fixtures and use_instantiated_fixtures.
|
24
|
-
You'll need to update spec/spec_helper.rb accordingly. You can either
|
25
|
-
just re-generate it:
|
26
|
-
|
27
3
|
script/generate rspec
|
28
4
|
|
29
5
|
Or modify spec_helper.rb based on the template, which can be found at:
|
data/bin/spec
CHANGED
File without changes
|
data/bin/spec_translator
CHANGED
File without changes
|
File without changes
|
data/lib/autotest/rspec.rb
CHANGED
@@ -21,17 +21,15 @@ class Autotest::Rspec < Autotest
|
|
21
21
|
|
22
22
|
def initialize
|
23
23
|
super
|
24
|
-
|
25
24
|
self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m
|
26
|
-
self.completed_re = /\
|
25
|
+
self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
|
27
26
|
end
|
28
|
-
|
27
|
+
|
29
28
|
def consolidate_failures(failed)
|
30
|
-
filters =
|
31
|
-
failed.each do |spec,
|
32
|
-
if
|
33
|
-
filters[
|
34
|
-
break
|
29
|
+
filters = new_hash_of_arrays
|
30
|
+
failed.each do |spec, trace|
|
31
|
+
if trace =~ /\n(\.\/)?(.*\.rb):[\d]+:\Z?/
|
32
|
+
filters[$2] << spec
|
35
33
|
end
|
36
34
|
end
|
37
35
|
return filters
|
@@ -41,7 +39,7 @@ class Autotest::Rspec < Autotest
|
|
41
39
|
return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}"
|
42
40
|
end
|
43
41
|
|
44
|
-
def add_options_if_present
|
42
|
+
def add_options_if_present # :nodoc:
|
45
43
|
File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : ""
|
46
44
|
end
|
47
45
|
|
data/lib/spec/example.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'timeout'
|
2
|
-
require 'forwardable'
|
3
2
|
require 'spec/example/pending'
|
4
3
|
require 'spec/example/module_reopening_fix'
|
4
|
+
require 'spec/example/module_inclusion_warnings'
|
5
5
|
require 'spec/example/example_group_methods'
|
6
6
|
require 'spec/example/example_methods'
|
7
7
|
require 'spec/example/example_group'
|
@@ -7,14 +7,20 @@ module Spec
|
|
7
7
|
# config.mock_with :rspec, :mocha, :flexmock, or :rr
|
8
8
|
# end
|
9
9
|
#
|
10
|
-
# To use any other mock framework, you'll have to provide
|
11
|
-
#
|
12
|
-
#
|
10
|
+
# To use any other mock framework, you'll have to provide your own
|
11
|
+
# adapter. This is simply a module that responds to the following
|
12
|
+
# methods:
|
13
|
+
#
|
14
|
+
# setup_mocks_for_rspec
|
15
|
+
# verify_mocks_for_rspec
|
16
|
+
# teardown_mocks_for_rspec.
|
17
|
+
#
|
13
18
|
# These are your hooks into the lifecycle of a given example. RSpec will
|
14
|
-
# call setup_mocks_for_rspec before running anything else in each
|
15
|
-
# After executing the #after methods, RSpec will then call
|
16
|
-
# and teardown_mocks_for_rspec (this is
|
17
|
-
# failures in
|
19
|
+
# call setup_mocks_for_rspec before running anything else in each
|
20
|
+
# Example. After executing the #after methods, RSpec will then call
|
21
|
+
# verify_mocks_for_rspec and teardown_mocks_for_rspec (this is
|
22
|
+
# guaranteed to run even if there are failures in
|
23
|
+
# verify_mocks_for_rspec).
|
18
24
|
#
|
19
25
|
# Once you've defined this module, you can pass that to mock_with:
|
20
26
|
#
|
@@ -35,12 +41,18 @@ module Spec
|
|
35
41
|
@mock_framework ||= mock_framework_path("rspec")
|
36
42
|
end
|
37
43
|
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
+
# :call-seq:
|
45
|
+
# include(Some::Helpers)
|
46
|
+
# include(Some::Helpers, More::Helpers)
|
47
|
+
# include(My::Helpers, :type => :key)
|
48
|
+
#
|
49
|
+
# Declares modules to be included in multiple example groups
|
50
|
+
# (<tt>describe</tt> blocks). With no :type, the modules listed will be
|
51
|
+
# included in all example groups. Use :type to restrict the inclusion to
|
52
|
+
# a subset of example groups. The value assigned to :type should be a
|
53
|
+
# key that maps to a class that is either a subclass of
|
54
|
+
# Spec::Example::ExampleGroup or extends Spec::Example::ExampleGroupMethods
|
55
|
+
# and includes Spec::Example::ExampleMethods
|
44
56
|
#
|
45
57
|
# config.include(My::Pony, My::Horse, :type => :farm)
|
46
58
|
#
|
@@ -70,7 +82,7 @@ module Spec
|
|
70
82
|
#
|
71
83
|
# This makes it possible to say:
|
72
84
|
#
|
73
|
-
# person.should swim # passes if person.
|
85
|
+
# person.should swim # passes if person.can_swim? returns true
|
74
86
|
#
|
75
87
|
def predicate_matchers
|
76
88
|
@predicate_matchers ||= {}
|
@@ -85,10 +97,11 @@ module Spec
|
|
85
97
|
)
|
86
98
|
example_group.prepend_before(scope, &proc)
|
87
99
|
end
|
100
|
+
|
88
101
|
# Appends a global <tt>before</tt> block to all example groups.
|
89
102
|
#
|
90
|
-
# If you want to restrict the block to a subset of all the example
|
91
|
-
# specify this in a Hash as the last argument:
|
103
|
+
# If you want to restrict the block to a subset of all the example
|
104
|
+
# groups then specify this in a Hash as the last argument:
|
92
105
|
#
|
93
106
|
# config.prepend_before(:all, :type => :farm)
|
94
107
|
#
|
@@ -115,6 +128,7 @@ module Spec
|
|
115
128
|
example_group.prepend_after(scope, &proc)
|
116
129
|
end
|
117
130
|
alias_method :after, :prepend_after
|
131
|
+
|
118
132
|
# Appends a global <tt>after</tt> block to all example groups.
|
119
133
|
# See #append_before for filtering semantics.
|
120
134
|
def append_after(*args, &proc)
|