more fun stuff
This commit is contained in:
parent
7c843ee688
commit
8a1f30f76d
15
lib/cuke-pack/support/fakefs.rb
Normal file
15
lib/cuke-pack/support/fakefs.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Enable FakeFS support in scenarios tagged @fakefs
|
||||||
|
|
||||||
|
require 'fakefs/safe'
|
||||||
|
|
||||||
|
Before('@fakefs') do
|
||||||
|
FakeFS.activate!
|
||||||
|
end
|
||||||
|
|
||||||
|
After('@fakefs') do
|
||||||
|
ensure_mocha if respond_to?(:ensure_mocha)
|
||||||
|
|
||||||
|
FakeFS::FileSystem.clear
|
||||||
|
FakeFS.deactivate!
|
||||||
|
end
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
# promote reusability!
|
# promote reusability!
|
||||||
|
|
||||||
flay_exception = nil
|
flay_exception = nil
|
||||||
flay_level = 32 if flay_level == nil
|
flay_level ||= 30
|
||||||
# set me to a minimum sane level. don't go nuts refactoring!
|
# set me to a minimum sane level. don't go nuts refactoring!
|
||||||
# code should be cleaner when you're done, not become spaghetti.
|
# code should be cleaner when you're done, not become spaghetti.
|
||||||
|
|
||||||
|
26
lib/cuke-pack/support/mocha.rb
Normal file
26
lib/cuke-pack/support/mocha.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Enable mocha in scenarios tagged @mocha
|
||||||
|
|
||||||
|
require 'mocha'
|
||||||
|
|
||||||
|
World(Mocha::Standalone)
|
||||||
|
|
||||||
|
def ensure_mocha
|
||||||
|
return if @_mocha_ensured
|
||||||
|
|
||||||
|
begin
|
||||||
|
mocha_verify
|
||||||
|
ensure
|
||||||
|
mocha_teardown
|
||||||
|
end
|
||||||
|
|
||||||
|
@_mocha_ensured = true
|
||||||
|
end
|
||||||
|
|
||||||
|
Before('@mocha') do
|
||||||
|
mocha_setup
|
||||||
|
end
|
||||||
|
|
||||||
|
After('@mocha') do
|
||||||
|
ensure_mocha
|
||||||
|
end
|
||||||
|
|
@ -18,3 +18,6 @@ flay_level = 32
|
|||||||
|
|
||||||
require 'cuke-pack/support/flay'
|
require 'cuke-pack/support/flay'
|
||||||
|
|
||||||
|
# require 'cuke-pack/support/fakefs'
|
||||||
|
# require 'cuke-pack/support/mocha'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user