Commit 99beb3f8d9c87fc78c44f19d65f79b89c9405387

A SharedExampleGroup can be created within another ExampleGroup.

git-svn-id: http://rspec.rubyforge.org/svn/trunk@3296 410327ef-2207-0410-a325-f78bbcb22a5a

Commit diff

rspec/CHANGES

 
1* ExampleGroupMethods#xspecify aliases #xit
2
31== Version 1.1.4 (trunk)
42
53* Applied patch from Bob Cotton: Nested ExampleGroups do not have a spec_path. Closes #224.
55* Allow any type of render in view specs. Closes #57.
66* Applied patch from Coda Hale to get rspec calling autotest's :red hook. Closes #279.
77* Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271.
8* ExampleGroupMethods#xspecify aliases #xit
9* A SharedExampleGroup can be created within another ExampleGroup.
810
911== Version 1.1.3
1012
toggle raw diff

rspec/lib/spec/example/example_group_methods.rb

 
3636 def describe(*args, &example_group_block)
3737 args << {} unless Hash === args.last
3838 if example_group_block
39 args.last[:spec_path] = eval("caller(0)[1]", example_group_block) unless args.last[:spec_path]
40 self.subclass("Subclass") do
41 describe(*args)
42 module_eval(&example_group_block)
39 params = args.last
40 params[:spec_path] = eval("caller(0)[1]", example_group_block) unless params[:spec_path]
41 if params[:shared]
42 SharedExampleGroup.new(*args, &example_group_block)
43 else
44 self.subclass("Subclass") do
45 describe(*args)
46 module_eval(&example_group_block)
47 end
4348 end
4449 else
4550 set_description(*args)
toggle raw diff

rspec/lib/spec/version.rb

 
66 TINY = 3
77 RELEASE_CANDIDATE = nil
88
9 BUILD_TIME_UTC = 20080211053912
9 BUILD_TIME_UTC = 20080211062900
1010
1111 STRING = [MAJOR, MINOR, TINY].join('.')
1212 TAG = "REL_#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('_')}".upcase.gsub(/\.|-/, '_')
toggle raw diff

rspec/spec/spec/example/example_group_methods_spec.rb

 
2525 end
2626
2727 describe "#describe" do
28 attr_reader :child_example_group
29 before do
30 @child_example_group = @example_group.describe("Another ExampleGroup") do
31 it "should pass" do
32 true.should be_true
28 describe "when creating an ExampleGroup" do
29 attr_reader :child_example_group
30 before do
31 @child_example_group = @example_group.describe("Another ExampleGroup") do
32 it "should pass" do
33 true.should be_true
34 end
3335 end
3436 end
35 end
3637
37 it "should create a subclass of the ExampleGroup when passed a block" do
38 child_example_group.superclass.should == @example_group
39 @options.example_groups.should include(child_example_group)
38 it "should create a subclass of the ExampleGroup when passed a block" do
39 child_example_group.superclass.should == @example_group
40 @options.example_groups.should include(child_example_group)
41 end
42
43 it "should not inherit examples" do
44 child_example_group.examples.length.should == 1
45 end
4046 end
4147
42 it "should not inherit examples" do
43 child_example_group.examples.length.should == 1
48 describe "when creating a SharedExampleGroup" do
49 attr_reader :name, :shared_example_group
50 before do
51 @name = "A Shared ExampleGroup"
52 @shared_example_group = @example_group.describe(name, :shared => true) do
53 it "should pass" do
54 true.should be_true
55 end
56 end
57 end
58
59 after do
60 SharedExampleGroup.shared_example_groups.delete_if do |registered_shared_example_group|
61 registered_shared_example_group == shared_example_group
62 end
63 end
64
65 it "should create a SharedExampleGroup" do
66 SharedExampleGroup.find_shared_example_group(name).should == shared_example_group
67 end
4468 end
69
4570 end
4671
4772 describe "#it" do
toggle raw diff

rspec_on_rails/lib/spec/rails/version.rb

 
11module Spec
22 module Rails
33 module VERSION #:nodoc:
4 BUILD_TIME_UTC = 20080211053912
4 BUILD_TIME_UTC = 20080211062900
55 end
66 end
77end
toggle raw diff