Permalink
Browse files

make #share available in testcase, too

  • Loading branch information...
1 parent 425af6f commit 88076dabd19095a5f9b68b09c3670eaba3e46327 Sven Fuchs committed Dec 1, 2008
Showing with 16 additions and 11 deletions.
  1. +4 −0 lib/with.rb
  2. +12 −6 lib/with/dsl.rb
  3. +0 −5 lib/with/named_block.rb
View
@@ -3,6 +3,10 @@
require 'with/named_block'
module With
+ def self.included(base)
+ base.send :include, Dsl::Sharing
+ end
+
def describe(name, &block)
group = Group.new name, &block
group.compile(self)
View
@@ -1,5 +1,9 @@
module With
- module Dsl
+ module Dsl
+ def self.included(base)
+ base.send :include, Sharing
+ end
+
attr_reader :children
attr_accessor :parent
@@ -26,11 +30,13 @@ def assertion(name = nil, options = {}, &block)
group.assertions << NamedBlock.new(name, &block)
end
alias :it :assertion
-
- def share(*blocks, &block)
- name = blocks.shift
- blocks << block if block
- @shared[name] = blocks
+
+ module Sharing
+ def share(*blocks, &block)
+ name = blocks.shift
+ blocks << block if block
+ @shared[name] = blocks
+ end
end
end
end
View
@@ -10,10 +10,5 @@ def initialize(name, &block)
def to_proc
@block
end
-
- def call
- @block.call
- name
- end
end
end

0 comments on commit 88076da

Please sign in to comment.