use mocha mocking instead of punching ducks

This commit is contained in:
John Bintz 2011-06-28 11:06:36 -04:00
parent 343fd6f84b
commit 7316f77367
2 changed files with 32 additions and 32 deletions

View File

@ -44,6 +44,7 @@ module Jasmine
end
create_rails_compliant_task if defined?(Rails)
end
private
def create_rails_compliant_task
if Rails.version >= "3.1.0"

View File

@ -1,21 +1,19 @@
require 'spec_helper'
require 'fakefs/spec_helpers'
require 'jasmine/headless/task'
module Jasmine
module Headless
class Task
def desc(block); end
def task(block); end
end
end
end
require 'mocha'
describe Jasmine::Headless::Task do
after do
Object.send(:remove_const, :Rails) if defined?(Rails)
end
describe 'define task' do
before do
Jasmine::Headless::Task.any_instance.stubs(:desc)
Jasmine::Headless::Task.any_instance.stubs(:task)
end
context 'without Rails' do
it 'should not explode when Rails is undefined' do
Jasmine::Headless::Task.new('jasmine:headless')
@ -36,4 +34,5 @@ describe Jasmine::Headless::Task do
end
end
end
end