1 From f3ec07ad7022d69e87addbc8a273ff720d8e0165 Mon Sep 17 00:00:00 2001
2 From: Brian Ford <bford@engineyard.com>
3 Date: Wed, 16 Jul 2008 17:16:39 -0700
4 Subject: [PATCH] Updated version to 1.4.0. See below.
6 This version significantly breaks compatibility with older versions
7 in two areas: RSpec-style shared specs and nested 'describe' blocks.
8 A concurrent version guard has been placed in the RubySpec repo
9 (spec_helper.rb) to prevent running the updated RubySpecs with an
10 older version of MSpec.
12 See the README for information on shared and nested 'describe' blocks.
14 README | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++
15 lib/mspec/version.rb | 2 +-
16 mspec-1.3.1.gemspec | 33 ------------------
17 mspec-1.4.0.gemspec | 33 ++++++++++++++++++
18 4 files changed, 127 insertions(+), 34 deletions(-)
19 delete mode 100644 mspec-1.3.1.gemspec
20 create mode 100644 mspec-1.4.0.gemspec
22 diff --git a/README b/README
23 index 1429ac0..5400b08 100644
26 @@ -91,6 +91,99 @@ All of these should be applied to a block created with `lambda` or `proc`:
27 is associated with. The exception class can be given for finer-grained
28 control (inheritance works normally so Exception would catch everything.)
30 +== Nested 'describe' blocks
32 +MSpec supports nesting one 'describe' block inside another. The examples in
33 +the nested block are evaluated with all the before/after blocks of all the
34 +containing 'describe' blocks. The following example illustrates this:
36 +describe "Some#method" do
41 + describe "when passed String" do
46 + it "returns false" do
47 + # when this example is evaluated, @obj = 1 and @meth = :to_s
52 +The output when using the SpecdocFormatter (selected with -fs to the runners)
55 +Some#method when passed String
59 +== Shared 'describe' blocks
61 +MSpec supports RSpec-style shared 'describe' blocks. MSpec also provides a
62 +convenience method to assist in writing specs for the numerous aliased methods
63 +that Ruby provides. The following example illustrates shared blocks:
65 +describe :someclass_some_method, :shared => true do
66 + it "does something" do
70 +describe "SomeClass#some_method" do
71 + it_should_behave_like "someclass_some_method"
74 +The first argument to 'describe' for a shared block is an object that
75 +duck-types as a String. The representation of the object must be unique. This
76 +example uses a symbol. This was the convention for the previous facility that
77 +MSpec provided for aliased method (#it_behaves_like). However, this convention
78 +is not set in stone (but the uniqueness requirement is). Note that the
79 +argument to the #it_should_behave_like is a String because at this time RSpec
80 +will not find the shared block by the symbol.
82 +MSpec continues to support the #it_behaves_like convenience method for
83 +specifying aliased methods. The syntax is as follows:
85 +it_behaves_like :symbol_matching_shared_describe, :method [, :object]
87 +describe :someclass_some_method, :shared => true do
88 + it "returns true" do
89 + obj.send(@method).should be_true
92 + it "returns something else" do
93 + @object.send(@method).should be_something_else
98 +describe "SomeClass#some_method" do
99 + it_behaves_like :someclass_some_method, :other_method
103 +describe "SomeOtherClass#some_method" do
104 + it_behaves_like :someclass_some_method, :some_method, OtherClass
107 +The first form above (#1) is used for typical aliases. That is, methods with
108 +different names on the same class that behave identically. The
109 +#it_behaves_like helper creates a before(:all) block that sets @method to
110 +:other_method. The form of the first example block in the shared block
111 +illustrates the typical form of a spec for an aliased method.
113 +The second form above (#2) is used for methods on different classes that are
114 +essentially aliases, even though Ruby does not provide a syntax for specifying
115 +such methods as aliases. Examples are the methods on File, FileTest, and
116 +File::Stat. In this case, the #it_behaves_like helper sets both @method and
117 +@object in the before(:all) block (@method = :some_method, @object =
118 +OtherClass in this example).
120 +For shared specs that fall outside of either of these two narrow categories,
121 +use nested or shared 'describe' blocks as appropriate and use the
122 +#it_should_behave_like method directly.
126 diff --git a/lib/mspec/version.rb b/lib/mspec/version.rb
127 index 0a75f11..6a7efc6 100644
128 --- a/lib/mspec/version.rb
129 +++ b/lib/mspec/version.rb
135 diff --git a/mspec-1.3.1.gemspec b/mspec-1.3.1.gemspec
136 deleted file mode 100644
137 index 5bf371c..0000000
138 --- a/mspec-1.3.1.gemspec
141 -Gem::Specification.new do |s|
143 - s.version = "1.3.1"
145 - s.specification_version = 2 if s.respond_to? :specification_version=
147 - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
148 - s.authors = ["Brian Ford"]
149 - s.date = %q{2008-05-21}
150 - s.email = %q{bford@engineyard.com}
152 - s.extra_rdoc_files = %w[ README LICENSE ]
153 - s.executables = ["mkspec", "mspec", "mspec-ci", "mspec-run", "mspec-tag"]
154 - s.files = FileList[ '{bin,lib,spec}/**/*.{yaml,txt,rb}', 'Rakefile', *s.extra_rdoc_files ]
155 - s.homepage = %q{http://rubyspec.org}
156 - s.rubyforge_project = 'http://rubyforge.org/projects/mspec'
157 - s.require_paths = ["lib"]
158 - s.rubygems_version = %q{1.1.1}
160 -MSpec is a specialized framework that is syntax-compatible
161 -with RSpec for basic things like describe, it blocks and
162 -before, after actions.
164 -MSpec contains additional features that assist in writing
165 -the RubySpecs used by multiple Ruby implementations. Also,
166 -MSpec attempts to use the simplest Ruby language features
167 -so that beginning Ruby implementations can run it.
170 - s.rdoc_options << '--title' << 'MSpec Gem' <<
171 - '--main' << 'README' <<
174 \ No newline at end of file
175 diff --git a/mspec-1.4.0.gemspec b/mspec-1.4.0.gemspec
177 index 0000000..8d47f7c
179 +++ b/mspec-1.4.0.gemspec
181 +Gem::Specification.new do |s|
183 + s.version = "1.4.0"
185 + s.specification_version = 2 if s.respond_to? :specification_version=
187 + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
188 + s.authors = ["Brian Ford"]
189 + s.date = %q{2008-05-21}
190 + s.email = %q{bford@engineyard.com}
192 + s.extra_rdoc_files = %w[ README LICENSE ]
193 + s.executables = ["mkspec", "mspec", "mspec-ci", "mspec-run", "mspec-tag"]
194 + s.files = FileList[ '{bin,lib,spec}/**/*.{yaml,txt,rb}', 'Rakefile', *s.extra_rdoc_files ]
195 + s.homepage = %q{http://rubyspec.org}
196 + s.rubyforge_project = 'http://rubyforge.org/projects/mspec'
197 + s.require_paths = ["lib"]
198 + s.rubygems_version = %q{1.1.1}
200 +MSpec is a specialized framework that is syntax-compatible
201 +with RSpec for basic things like describe, it blocks and
202 +before, after actions.
204 +MSpec contains additional features that assist in writing
205 +the RubySpecs used by multiple Ruby implementations. Also,
206 +MSpec attempts to use the simplest Ruby language features
207 +so that beginning Ruby implementations can run it.
210 + s.rdoc_options << '--title' << 'MSpec Gem' <<
211 + '--main' << 'README' <<
214 \ No newline at end of file