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 end
create_rails_compliant_task if defined?(Rails) create_rails_compliant_task if defined?(Rails)
end end
private private
def create_rails_compliant_task def create_rails_compliant_task
if Rails.version >= "3.1.0" if Rails.version >= "3.1.0"

View File

@ -1,21 +1,19 @@
require 'spec_helper' require 'spec_helper'
require 'fakefs/spec_helpers' require 'fakefs/spec_helpers'
require 'jasmine/headless/task' require 'jasmine/headless/task'
require 'mocha'
module Jasmine
module Headless
class Task
def desc(block); end
def task(block); end
end
end
end
describe Jasmine::Headless::Task do describe Jasmine::Headless::Task do
after do after do
Object.send(:remove_const, :Rails) if defined?(Rails) Object.send(:remove_const, :Rails) if defined?(Rails)
end 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 context 'without Rails' do
it 'should not explode when Rails is undefined' do it 'should not explode when Rails is undefined' do
Jasmine::Headless::Task.new('jasmine:headless') Jasmine::Headless::Task.new('jasmine:headless')
@ -35,5 +33,6 @@ describe Jasmine::Headless::Task do
Jasmine::Headless::Task.new('jasmine:headless') Jasmine::Headless::Task.new('jasmine:headless')
end end
end end
end
end end