diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2008-02-10 18:42:32 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2008-02-10 18:42:32 +0100 |
commit | 1378e5819affacecbc1291d1e676fd8d5efeafc2 (patch) | |
tree | 792da43c897ed5aeae8d6f5bae580eaafa71507c | |
parent | 96f476e7ad3e0ff5951df57f07f38164a021e1b5 (diff) | |
download | bacon-1378e5819affacecbc1291d1e676fd8d5efeafc2.tar.gz bacon-1378e5819affacecbc1291d1e676fd8d5efeafc2.tar.xz bacon-1378e5819affacecbc1291d1e676fd8d5efeafc2.zip |
Empty specifications are now erroneous
darcs-hash:20080210174232-4fc50-502a7c3601bcbd28b1ec6befde599762d939effa.gz
-rw-r--r-- | lib/bacon.rb | 5 | ||||
-rw-r--r-- | test/spec_should.rb | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb index 72342a3..3277503 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -140,7 +140,12 @@ module Bacon begin Counter[:depth] += 1 @before.each { |block| instance_eval(&block) } + prev_req = Counter[:requirements] instance_eval(&spec) + if Counter[:requirements] == prev_req + raise Error.new(:missing, + "empty specification: #{@name} #{description}") + end @after.each { |block| instance_eval(&block) } rescue Object => e ErrorLog << "#{e.class}: #{e.message}\n" diff --git a/test/spec_should.rb b/test/spec_should.rb index 25557a3..c31e8c7 100644 --- a/test/spec_should.rb +++ b/test/spec_should.rb @@ -3,7 +3,8 @@ require File.join(File.dirname(__FILE__), '../lib/bacon') describe "#should shortcut for #it('should')" do should "be called" do - @called= true + @called = true + @called.should.be == true end should "save some characters by typing should" do |