| |   |
| 1 | == Version 1.1.4 (trunk) |
| 2 | |
| 3 | Maintenance release. |
| 4 | Note: we've removed the metaclass method from Object. There were some generated specs that |
| 5 | used it, and they will now break. Just replace the metaclass call with (class << self; self; end) |
| 6 | and all will be well. |
| 7 | |
| 8 | * Applied patch from Zach Dennis to merge :steps functionality to :steps_for. Closes #324. |
| 9 | * Applied patch from Pat Maddox to handle redirect_to w/ SSL. Closes #320. |
| 10 | * Applied patch from Ryan Davis to add eval of block passed to raise_error matcher. Closes #321. |
| 11 | * alias :context :describe in example_group_methods. Closes #312. |
| 12 | * Applied patch from Ben Mabey to make the Story runner exit with a non-0 exit code on failing stories. Closes #228. |
| 13 | * Added #helper and #assigns to helper specs. |
| 14 | * Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162. |
| 15 | * Tweaked list of exceptions (ignores) for autotest with rspec_on_rails. |
| 16 | * Applied patch from Coda Hale to get the :red hook called in autotest. Closes #279. |
| 17 | * Applied patch from Patrick Ritchie to support --drb in spec.opts. Closes #274, #293. |
| 18 | * Applied patch from Rick Olson to get rspec_on_rails working with rails edge (>= 8862) |
| 19 | * Moved metaclass method from Object to an internal module which gets included where it is needed. |
| 20 | * Applied patch from Dayo Esho: and_yield clobbers return value from block. Closes #217. |
| 21 | * Applied patch from Bob Cotton: ExampleGroupFactory.default resets previously registered types. Closes #222. |
| 22 | * Applied patch from Mike Williams to support the lib directory in rails apps with the Textmate Alternate File command. Closes #276. |
| 23 | * ExampleGroupMethods#xspecify aliases #xit |
| 24 | * A SharedExampleGroup can be created within another ExampleGroup. |
| 25 | * Applied patch from Bob Cotton: Nested ExampleGroups do not have a spec_path. Closes #224. |
| 26 | * Applied patch from Wincent Colaiuta to invert sense of "spec --diff". Closes #281. |
| 27 | * Allow any type of render in view specs. Closes #57. |
| 28 | * Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271. |
| 29 | |
| 30 | == Version 1.1.3 |
| 31 | |
| 32 | Maintenance release. |
| 33 | Notice to autotest users: you must also upgrade to ZenTest-3.9.0. |
| 34 | |
| 35 | * Tightened up exceptions list in autotest/rails_spec. Closes #264. |
| 36 | * Applied patch from Ryan Davis for ZenTest-3.9.0 compatibility |
| 37 | * Applied patch from Kero to add step_upcoming to story listeners. Closes #253. |
| 38 | * Fixed bug where the wrong named error was not always caught by "should raise_error" |
| 39 | * Applied patch from Luis Lavena: No coloured output on Windows due missing RUBYOPT. Closes #244. |
| 40 | * Applied patch from Craig Demyanovich to add support for "should_not render_template" to rspec_on_rails. Closes #241. |
| 41 | * Added --pattern (-p for short) option to control what files get loaded. Defaults to '**/*_spec.rb' |
| 42 | * Exit with non-0 exit code if examples *or tests* (in test/unit interop mode) fail. Closes #203. |
| 43 | * Moved at_exit hook to a method in Spec::Runner which only runs if specs get loaded. Closes #242. |
| 44 | * Applied patch from kakutani ensuring that base_view_path gets cleared after each view example. Closes #235. |
| 45 | * More tweaks to regexp step names |
| 46 | * Fixed focused specs in nested ExampleGroups. Closes #225. |
| 47 | |
| 48 | == Version 1.1.2 |
| 49 | |
| 50 | Minor bug fixes/enhancements. |
| 51 | Notice to autotest users: you must also upgrade to ZenTest-3.8.0. |
| 52 | |
| 53 | * RSpec's Autotest subclasses compatible with ZenTest-3.8.0 (thanks to Ryan Davis for making it easier on Autotest subs). |
| 54 | * Applied patch from idl to add spec/lib to rake stats. Closes #226. |
| 55 | * calling setup_fixtures and teardown_fixtures for Rails >= r8570. Closes #219. |
| 56 | * Applied patch from Josh Knowles using ActiveSupport's Inflector (when available) to make 'should have' read a bit better. Closes #197. |
| 57 | * Fixed regression in 1.1 that caused failing examples to fail to generate their own names. Closes #209. |
| 58 | * Applied doc patch from Jens Krämer for capturing content_for |
| 59 | * Applied patch from Alexander Lang to clean up story steps after each story. Closes #198. |
| 60 | * Applied patch from Josh Knowles to support 'string_or_response.should have_text(...)'. Closes #193. |
| 61 | * Applied patch from Ian Dees to quiet the Story Runner backtrace. Closes #183. |
| 62 | * Complete support for defining steps with regexp 'names'. |
| 63 | |
| 64 | == Version 1.1.1 |
| 65 | |
| 66 | Bug fix release. |
| 67 | |
| 68 | * Fix regression in 1.1.0 that caused transactions to not get rolled back between examples. |
| 69 | * Applied patch from Bob Cotton to reintroduce ExampleGroup.description_options. Closes LH[#186] |
| 70 | |
| 1 | 71 | == Version 1.1.0 |
| 2 | 72 | |
| 3 | 73 | The "tell me a story and go nest yourself" release. |
| … | … | |
| 75 | 75 | * Applied patch from Mike Vincent to handle generators rails > 2.0.1. Closes LH[#181] |
| 76 | 76 | * Formatter.pending signature changed so it gets passed an ExampleGroup instance instead of the name ( LH[#180]) |
| 77 | 77 | * Fixed LH[#180] Spec::Rails::Example::ModelExampleGroup and friends show up in rspec/rails output |
| 78 | | * Spec::Rails no longer loads ActiveRecord extensions if it's disablet in config/boot.rb |
| 78 | * Spec::Rails no longer loads ActiveRecord extensions if it's disabled in config/boot.rb |
| 79 | 79 | * Applied LH[#178] small annoyances running specs with warnings enabled (Patch from Mikko Lehtonen) |
| 80 | 80 | * Tighter integration with Rails fixtures. Take advantage of fixture caching to get performance improvements (Thanks to Pat Maddox, Nick Kallen, Jonathan Barnes, and Curtis) |
| 81 | 81 | |
| … | … | |
| 109 | 109 | * Applied LH[#134] Only load spec inside spec_helper.rb (Patch from Mark Van Holstyn) |
| 110 | 110 | * RSpec now bails immediately if there are examples with identical names. |
| 111 | 111 | * Applied LH[#132] Plain Text stories should support Given and Given: (Patch from Jarkko Laine) |
| 112 | * Applied patch from Pat Maddox: Story Mediator - the glue that binds the plain text story parser with the rest of the system |
| 112 | 113 | * Applied LH[#16] Have SimpleMatchers expose their description for specdocs (Patch from Bryan Helmkamp) |
| 113 | 114 | * Stories now support --colour |
| 114 | 115 | * Changed the DSL modules to Example (i.e. Spec::Example instead of Spec::DSL) |
| toggle raw diff |
--- a/vendor/plugins/rspec/CHANGES
+++ b/vendor/plugins/rspec/CHANGES
@@ -1,3 +1,73 @@
+== Version 1.1.4 (trunk)
+
+Maintenance release.
+Note: we've removed the metaclass method from Object. There were some generated specs that
+used it, and they will now break. Just replace the metaclass call with (class << self; self; end)
+and all will be well.
+
+* Applied patch from Zach Dennis to merge :steps functionality to :steps_for. Closes #324.
+* Applied patch from Pat Maddox to handle redirect_to w/ SSL. Closes #320.
+* Applied patch from Ryan Davis to add eval of block passed to raise_error matcher. Closes #321.
+* alias :context :describe in example_group_methods. Closes #312.
+* Applied patch from Ben Mabey to make the Story runner exit with a non-0 exit code on failing stories. Closes #228.
+* Added #helper and #assigns to helper specs.
+* Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162.
+* Tweaked list of exceptions (ignores) for autotest with rspec_on_rails.
+* Applied patch from Coda Hale to get the :red hook called in autotest. Closes #279.
+* Applied patch from Patrick Ritchie to support --drb in spec.opts. Closes #274, #293.
+* Applied patch from Rick Olson to get rspec_on_rails working with rails edge (>= 8862)
+* Moved metaclass method from Object to an internal module which gets included where it is needed.
+* Applied patch from Dayo Esho: and_yield clobbers return value from block. Closes #217.
+* Applied patch from Bob Cotton: ExampleGroupFactory.default resets previously registered types. Closes #222.
+* Applied patch from Mike Williams to support the lib directory in rails apps with the Textmate Alternate File command. Closes #276.
+* ExampleGroupMethods#xspecify aliases #xit
+* A SharedExampleGroup can be created within another ExampleGroup.
+* Applied patch from Bob Cotton: Nested ExampleGroups do not have a spec_path. Closes #224.
+* Applied patch from Wincent Colaiuta to invert sense of "spec --diff". Closes #281.
+* Allow any type of render in view specs. Closes #57.
+* Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271.
+
+== Version 1.1.3
+
+Maintenance release.
+Notice to autotest users: you must also upgrade to ZenTest-3.9.0.
+
+* Tightened up exceptions list in autotest/rails_spec. Closes #264.
+* Applied patch from Ryan Davis for ZenTest-3.9.0 compatibility
+* Applied patch from Kero to add step_upcoming to story listeners. Closes #253.
+* Fixed bug where the wrong named error was not always caught by "should raise_error"
+* Applied patch from Luis Lavena: No coloured output on Windows due missing RUBYOPT. Closes #244.
+* Applied patch from Craig Demyanovich to add support for "should_not render_template" to rspec_on_rails. Closes #241.
+* Added --pattern (-p for short) option to control what files get loaded. Defaults to '**/*_spec.rb'
+* Exit with non-0 exit code if examples *or tests* (in test/unit interop mode) fail. Closes #203.
+* Moved at_exit hook to a method in Spec::Runner which only runs if specs get loaded. Closes #242.
+* Applied patch from kakutani ensuring that base_view_path gets cleared after each view example. Closes #235.
+* More tweaks to regexp step names
+* Fixed focused specs in nested ExampleGroups. Closes #225.
+
+== Version 1.1.2
+
+Minor bug fixes/enhancements.
+Notice to autotest users: you must also upgrade to ZenTest-3.8.0.
+
+* RSpec's Autotest subclasses compatible with ZenTest-3.8.0 (thanks to Ryan Davis for making it easier on Autotest subs).
+* Applied patch from idl to add spec/lib to rake stats. Closes #226.
+* calling setup_fixtures and teardown_fixtures for Rails >= r8570. Closes #219.
+* Applied patch from Josh Knowles using ActiveSupport's Inflector (when available) to make 'should have' read a bit better. Closes #197.
+* Fixed regression in 1.1 that caused failing examples to fail to generate their own names. Closes #209.
+* Applied doc patch from Jens Krämer for capturing content_for
+* Applied patch from Alexander Lang to clean up story steps after each story. Closes #198.
+* Applied patch from Josh Knowles to support 'string_or_response.should have_text(...)'. Closes #193.
+* Applied patch from Ian Dees to quiet the Story Runner backtrace. Closes #183.
+* Complete support for defining steps with regexp 'names'.
+
+== Version 1.1.1
+
+Bug fix release.
+
+* Fix regression in 1.1.0 that caused transactions to not get rolled back between examples.
+* Applied patch from Bob Cotton to reintroduce ExampleGroup.description_options. Closes LH[#186]
+
== Version 1.1.0
The "tell me a story and go nest yourself" release.
@@ -5,7 +75,7 @@ The "tell me a story and go nest yourself" release.
* Applied patch from Mike Vincent to handle generators rails > 2.0.1. Closes LH[#181]
* Formatter.pending signature changed so it gets passed an ExampleGroup instance instead of the name ( LH[#180])
* Fixed LH[#180] Spec::Rails::Example::ModelExampleGroup and friends show up in rspec/rails output
-* Spec::Rails no longer loads ActiveRecord extensions if it's disablet in config/boot.rb
+* Spec::Rails no longer loads ActiveRecord extensions if it's disabled in config/boot.rb
* Applied LH[#178] small annoyances running specs with warnings enabled (Patch from Mikko Lehtonen)
* Tighter integration with Rails fixtures. Take advantage of fixture caching to get performance improvements (Thanks to Pat Maddox, Nick Kallen, Jonathan Barnes, and Curtis)
@@ -39,6 +109,7 @@ rspec_on_rails users - don't forget to run script/generate rspec
* Applied LH[#134] Only load spec inside spec_helper.rb (Patch from Mark Van Holstyn)
* RSpec now bails immediately if there are examples with identical names.
* Applied LH[#132] Plain Text stories should support Given and Given: (Patch from Jarkko Laine)
+* Applied patch from Pat Maddox: Story Mediator - the glue that binds the plain text story parser with the rest of the system
* Applied LH[#16] Have SimpleMatchers expose their description for specdocs (Patch from Bryan Helmkamp)
* Stories now support --colour
* Changed the DSL modules to Example (i.e. Spec::Example instead of Spec::DSL) |
| |   |
| 38 | 38 | |
| 39 | 39 | * rake # Runs the build script |
| 40 | 40 | * rcov # Verifies that the code is 100% covered by specs |
| 41 | | * webgen # Generates the static HTML website |
| 42 | | * RedCloth # Required by webgen |
| 43 | | * syntax # Required by our own custom webgen extension to highlight ruby code |
| 41 | * webby # Generates the static HTML website |
| 42 | * syntax # Required to highlight ruby code |
| 44 | 43 | * diff-lcs # Required if you use the --diff switch |
| 45 | 44 | * win32console # Required by the --colour switch if you're on Windows |
| 46 | 45 | * meta_project # Required in order to make releases at RubyForge |
| … | … | |
| 65 | 65 | * The spec command line uses heckle when --heckle is specified. |
| 66 | 66 | * The Spec::Rake::SpecTask needs RCov if RCov is enabled in the task. |
| 67 | 67 | |
| 68 | | See http://rspec.rubyforge.org for further documentation. |
| 68 | See http://rspec.info for further documentation. |
| 69 | 69 | |
| 70 | 70 | == Contributing |
| 71 | 71 | |
| toggle raw diff |
--- a/vendor/plugins/rspec/README
+++ b/vendor/plugins/rspec/README
@@ -38,9 +38,8 @@ In order to run RSpec's full suite of specs (rake pre_commit) you must install t
* rake # Runs the build script
* rcov # Verifies that the code is 100% covered by specs
-* webgen # Generates the static HTML website
-* RedCloth # Required by webgen
-* syntax # Required by our own custom webgen extension to highlight ruby code
+* webby # Generates the static HTML website
+* syntax # Required to highlight ruby code
* diff-lcs # Required if you use the --diff switch
* win32console # Required by the --colour switch if you're on Windows
* meta_project # Required in order to make releases at RubyForge
@@ -66,7 +65,7 @@ and stdlib - with a few exceptions:
* The spec command line uses heckle when --heckle is specified.
* The Spec::Rake::SpecTask needs RCov if RCov is enabled in the task.
-See http://rspec.rubyforge.org for further documentation.
+See http://rspec.info for further documentation.
== Contributing
|
| |   |
| 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")) |
| 10 | $LOAD_PATH.unshift(File.expand_path("#{dir}/pre_commit/lib")) |
| 11 | 11 | require "pre_commit" |
| 12 | 12 | |
| 13 | 13 | # Some of the tasks are in separate files since they are also part of the website documentation |
| … | … | |
| 22 | 22 | PKG_FILES = FileList[ |
| 23 | 23 | '[A-Z]*', |
| 24 | 24 | 'lib/**/*.rb', |
| 25 | | 'spec/**/*.rb', |
| 25 | 'spec/**/*', |
| 26 | 26 | 'examples/**/*', |
| 27 | 'failing_examples/**/*', |
| 27 | 28 | 'plugins/**/*', |
| 28 | | 'stories/**/*' |
| 29 | 'stories/**/*', |
| 30 | 'pre_commit/**/*', |
| 31 | 'rake_tasks/**/*' |
| 29 | 32 | ] |
| 30 | 33 | |
| 31 | 34 | task :default => [:verify_rcov] |
| … | … | |
| 37 | 37 | desc "Run all specs" |
| 38 | 38 | Spec::Rake::SpecTask.new do |t| |
| 39 | 39 | t.spec_files = FileList['spec/**/*_spec.rb'] |
| 40 | | t.spec_opts = ['--options', 'spec.opts'] |
| 40 | t.spec_opts = ['--options', 'spec/spec.opts'] |
| 41 | 41 | unless ENV['NO_RCOV'] |
| 42 | 42 | t.rcov = true |
| 43 | 43 | t.rcov_dir = '../doc/output/coverage' |
| … | … | |
| 90 | 90 | s.rdoc_options = rd.options |
| 91 | 91 | s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$|^EXAMPLES.rd$/ }.to_a |
| 92 | 92 | |
| 93 | | s.autorequire = 'spec' |
| 94 | 93 | s.bindir = 'bin' |
| 95 | 94 | s.executables = ['spec', 'spec_translator'] |
| 96 | 95 | s.default_executable = 'spec' |
| … | … | |
| 128 | 128 | core.clobber |
| 129 | 129 | end |
| 130 | 130 | |
| 131 | | task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_website, :publish_news] |
| 131 | task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_news] |
| 132 | 132 | |
| 133 | 133 | desc "Verifies that there is no uncommitted code" |
| 134 | 134 | task :verify_committed do |
| toggle raw diff |
--- a/vendor/plugins/rspec/Rakefile
+++ b/vendor/plugins/rspec/Rakefile
@@ -7,7 +7,7 @@ require 'rake/rdoctask'
require 'rake/testtask'
require 'spec/version'
dir = File.dirname(__FILE__)
-$LOAD_PATH.unshift(File.expand_path("#{dir}/../pre_commit/lib"))
+$LOAD_PATH.unshift(File.expand_path("#{dir}/pre_commit/lib"))
require "pre_commit"
# Some of the tasks are in separate files since they are also part of the website documentation
@@ -22,10 +22,13 @@ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_FILES = FileList[
'[A-Z]*',
'lib/**/*.rb',
- 'spec/**/*.rb',
+ 'spec/**/*',
'examples/**/*',
+ 'failing_examples/**/*',
'plugins/**/*',
- 'stories/**/*'
+ 'stories/**/*',
+ 'pre_commit/**/*',
+ 'rake_tasks/**/*'
]
task :default => [:verify_rcov]
@@ -34,7 +37,7 @@ task :verify_rcov => [:spec, :stories]
desc "Run all specs"
Spec::Rake::SpecTask.new do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['--options', 'spec.opts']
+ t.spec_opts = ['--options', 'spec/spec.opts']
unless ENV['NO_RCOV']
t.rcov = true
t.rcov_dir = '../doc/output/coverage'
@@ -87,7 +90,6 @@ spec = Gem::Specification.new do |s|
s.rdoc_options = rd.options
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$|^EXAMPLES.rd$/ }.to_a
- s.autorequire = 'spec'
s.bindir = 'bin'
s.executables = ['spec', 'spec_translator']
s.default_executable = 'spec'
@@ -126,7 +128,7 @@ task :clobber do
core.clobber
end
-task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_website, :publish_news]
+task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_news]
desc "Verifies that there is no uncommitted code"
task :verify_committed do |
| |   |
| 19 | 19 | end |
| 20 | 20 | end |
| 21 | 21 | |
| 22 | | # A SharedExampleGroup is a module, so you can assign |
| 23 | | # it to a constant if you want .... |
| 24 | | AllThings = shared_examples_for "All Things" do |
| 22 | # A SharedExampleGroup is an example group that doesn't get run. |
| 23 | # You can create one like this: |
| 24 | share_examples_for "most things" do |
| 25 | 25 | def helper_method |
| 26 | 26 | "helper method" |
| 27 | 27 | end |
| … | … | |
| 30 | 30 | @thing.what_things_do.should == "stuff" |
| 31 | 31 | end |
| 32 | 32 | end |
| 33 | | |
| 34 | | # TODO - it would be nice to be able to say this instead of the above: |
| 35 | | |
| 36 | | # class AllThings < Spec::SharedExampleGroup |
| 37 | | # ... |
| 38 | | # end |
| 39 | 33 | |
| 34 | # A SharedExampleGroup is also module. If you create one like this |
| 35 | # it gets assigned to the constant AllThings |
| 36 | share_as :MostThings do |
| 37 | def helper_method |
| 38 | "helper method" |
| 39 | end |
| 40 | |
| 41 | it "should do what things do" do |
| 42 | @thing.what_things_do.should == "stuff" |
| 43 | end |
| 44 | end |
| 45 | |
| 40 | 46 | describe OneThing do |
| 41 | | # ... then you can include the example group like this, which |
| 47 | # Now you can include the shared example group like this, which |
| 42 | 48 | # feels more like what you might say ... |
| 43 | | it_should_behave_like "All Things" |
| 49 | it_should_behave_like "most things" |
| 50 | |
| 44 | 51 | before(:each) { @thing = OneThing.new } |
| 45 | 52 | |
| 46 | 53 | it "should have access to helper methods defined in the shared example group" do |
| … | … | |
| 58 | 58 | describe AnotherThing do |
| 59 | 59 | # ... or you can include the example group like this, which |
| 60 | 60 | # feels more like the programming language we love. |
| 61 | | it_should_behave_like AllThings |
| 61 | it_should_behave_like MostThings |
| 62 | 62 | |
| 63 | 63 | before(:each) { @thing = AnotherThing.new } |
| 64 | |
| 65 | it "should have access to helper methods defined in the shared example group" do |
| 66 | helper_method.should == "helper method" |
| 67 | end |
| 64 | 68 | end |
| 65 | 69 | |
| 66 | 70 | describe YetAnotherThing do |
| 67 | 71 | # ... or you can include the example group like this, which |
| 68 | 72 | # feels more like the programming language we love. |
| 69 | | include AllThings |
| 73 | include MostThings |
| 70 | 74 | |
| 71 | 75 | before(:each) { @thing = AnotherThing.new } |
| 76 | |
| 77 | it "should have access to helper methods defined in the shared example group" do |
| 78 | helper_method.should == "helper method" |
| 79 | end |
| 72 | 80 | end |
| 73 | 81 | end |
| toggle raw diff |
--- a/vendor/plugins/rspec/examples/pure/shared_example_group_example.rb
+++ b/vendor/plugins/rspec/examples/pure/shared_example_group_example.rb
@@ -19,9 +19,9 @@ module SharedExampleGroupExample
end
end
- # A SharedExampleGroup is a module, so you can assign
- # it to a constant if you want ....
- AllThings = shared_examples_for "All Things" do
+ # A SharedExampleGroup is an example group that doesn't get run.
+ # You can create one like this:
+ share_examples_for "most things" do
def helper_method
"helper method"
end
@@ -30,17 +30,24 @@ module SharedExampleGroupExample
@thing.what_things_do.should == "stuff"
end
end
-
- # TODO - it would be nice to be able to say this instead of the above:
-
- # class AllThings < Spec::SharedExampleGroup
- # ...
- # end
+ # A SharedExampleGroup is also module. If you create one like this
+ # it gets assigned to the constant AllThings
+ share_as :MostThings do
+ def helper_method
+ "helper method"
+ end
+
+ it "should do what things do" do
+ @thing.what_things_do.should == "stuff"
+ end
+ end
+
describe OneThing do
- # ... then you can include the example group like this, which
+ # Now you can include the shared example group like this, which
# feels more like what you might say ...
- it_should_behave_like "All Things"
+ it_should_behave_like "most things"
+
before(:each) { @thing = OneThing.new }
it "should have access to helper methods defined in the shared example group" do
@@ -51,16 +58,24 @@ module SharedExampleGroupExample
describe AnotherThing do
# ... or you can include the example group like this, which
# feels more like the programming language we love.
- it_should_behave_like AllThings
+ it_should_behave_like MostThings
before(:each) { @thing = AnotherThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
end
describe YetAnotherThing do
# ... or you can include the example group like this, which
# feels more like the programming language we love.
- include AllThings
+ include MostThings
before(:each) { @thing = AnotherThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
end
end |
| |   |
| 1 | 1 | require 'autotest' |
| 2 | 2 | |
| 3 | Autotest.add_hook :initialize do |at| |
| 4 | at.clear_mappings |
| 5 | # watch out: Ruby bug (1.8.6): |
| 6 | # %r(/) != /\// |
| 7 | at.add_mapping(%r%^spec/.*\.rb$%) { |filename, _| |
| 8 | filename |
| 9 | } |
| 10 | at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m| |
| 11 | ["spec/#{m[1]}_spec.rb"] |
| 12 | } |
| 13 | at.add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) { |
| 14 | at.files_matching %r%^spec/.*_spec\.rb$% |
| 15 | } |
| 16 | end |
| 17 | |
| 3 | 18 | class RspecCommandError < StandardError; end |
| 4 | 19 | |
| 5 | 20 | class Autotest::Rspec < Autotest |
| 6 | | |
| 7 | | def initialize(kernel=Kernel, separator=File::SEPARATOR, alt_separator=File::ALT_SEPARATOR) # :nodoc: |
| 8 | | super() |
| 9 | | @kernel, @separator, @alt_separator = kernel, separator, alt_separator |
| 10 | | @spec_command = spec_command |
| 11 | 21 | |
| 12 | | # watch out: Ruby bug (1.8.6): |
| 13 | | # %r(/) != /\// |
| 14 | | # since Ruby compares the REGEXP source, not the resulting pattern |
| 15 | | @test_mappings = { |
| 16 | | %r%^spec/.*\.rb$% => kernel.proc { |filename, _| |
| 17 | | filename |
| 18 | | }, |
| 19 | | %r%^lib/(.*)\.rb$% => kernel.proc { |_, m| |
| 20 | | ["spec/#{m[1]}_spec.rb"] |
| 21 | | }, |
| 22 | | %r%^spec/(spec_helper|shared/.*)\.rb$% => kernel.proc { |
| 23 | | files_matching %r%^spec/.*_spec\.rb$% |
| 24 | | } |
| 25 | | } |
| 26 | | end |
| 27 | | |
| 28 | | def tests_for_file(filename) |
| 29 | | super.select { |f| @files.has_key? f } |
| 22 | def initialize |
| 23 | super |
| 24 | self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m |
| 25 | self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m |
| 30 | 26 | end |
| 31 | 27 | |
| 32 | | alias :specs_for_file :tests_for_file |
| 33 | | |
| 34 | | def failed_results(results) |
| 35 | | results.scan(/^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m) |
| 36 | | end |
| 37 | | |
| 38 | | def handle_results(results) |
| 39 | | @files_to_test = consolidate_failures failed_results(results) |
| 40 | | unless @files_to_test.empty? then |
| 41 | | hook :red |
| 42 | | else |
| 43 | | hook :green |
| 44 | | end unless $TESTING |
| 45 | | @tainted = true unless @files_to_test.empty? |
| 46 | | end |
| 47 | | |
| 48 | 28 | def consolidate_failures(failed) |
| 49 | | filters = Hash.new { |h,k| h[k] = [] } |
| 50 | | failed.each do |spec, failed_trace| |
| 51 | | @files.keys.select{|f| f =~ /spec\//}.each do |f| |
| 52 | | if failed_trace =~ Regexp.new(f) |
| 53 | | filters[f] << spec |
| 54 | | break |
| 55 | | end |
| 29 | filters = new_hash_of_arrays |
| 30 | failed.each do |spec, trace| |
| 31 | if trace =~ /\n(\.\/)?(.*\.rb):[\d]+:\Z?/ |
| 32 | filters[$2] << spec |
| 56 | 33 | end |
| 57 | 34 | end |
| 58 | 35 | return filters |
| 59 | 36 | end |
| 60 | 37 | |
| 61 | 38 | def make_test_cmd(files_to_test) |
| 62 | | return "#{ruby} -S #{@spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}" |
| 39 | return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}" |
| 63 | 40 | end |
| 64 | 41 | |
| 65 | | def add_options_if_present |
| 42 | def add_options_if_present # :nodoc: |
| 66 | 43 | File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : "" |
| 67 | 44 | end |
| 68 | 45 | |
| 69 | | # Finds the proper spec command to use. Precendence |
| 70 | | # is set in the lazily-evaluated method spec_commands. Alias + Override |
| 71 | | # that in ~/.autotest to provide a different spec command |
| 72 | | # then the defau |