mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 09:40:13 +01:00
all non-cucumber tests are passing
This commit is contained in:
parent
13b58f3a10
commit
63175c115b
46 changed files with 248 additions and 505 deletions
29
backup.rails2.3/spec/models/message_gateway_spec.rb
Normal file
29
backup.rails2.3/spec/models/message_gateway_spec.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe MessageGateway do
|
||||
before :each do
|
||||
todo = mock_model(Todo, :description= => nil, :raw_notes= => nil, :context_id= => nil, :save! => nil)
|
||||
|
||||
@user = mock_model(User,
|
||||
:prefs => mock_model(Preference, :sms_context => mock_model(Context)),
|
||||
:todos => mock('Todo collection', :find => nil, :build => todo),
|
||||
:contexts => mock('Context collection', :exists? => true, :find => nil))
|
||||
|
||||
User.stub!(:find).and_return(@user)
|
||||
end
|
||||
|
||||
def load_message(filename)
|
||||
MessageGateway.receive(File.read(File.join(RAILS_ROOT, 'test', 'fixtures', filename)))
|
||||
end
|
||||
|
||||
|
||||
it "should dispatch on From: or To: according to site.yml" do
|
||||
SITE_CONFIG['email_dispatch'] = 'from'
|
||||
User.should_receive(:find).with(:first, :include => [:preference], :conditions => ["preferences.sms_email = ?", '5555555555@tmomail.net'])
|
||||
load_message('sample_email.txt')
|
||||
|
||||
SITE_CONFIG['email_dispatch'] = 'to'
|
||||
User.should_receive(:find).with(:first, :include => [:preference], :conditions => ["preferences.sms_email = ?", 'gtd@tracks.com'])
|
||||
load_message('sample_email.txt')
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue