diff --git a/spec/activesms/email_spec.rb b/spec/activesms/email_spec.rb index 4a41f09..8c9a72e 100644 --- a/spec/activesms/email_spec.rb +++ b/spec/activesms/email_spec.rb @@ -1,6 +1,5 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') - class Noter < ActiveSms::Base def emaio @delivery = :email @@ -22,47 +21,40 @@ def emaio Sms2Email.should_receive(:deliver_sms_message).with("5555555555@tim.com.br", "hi", "noreply@domain.com").and_return(true) Noter.deliver(sms) end - - - it "should determine a correct email address" do - Noter.get_sms_address('5543214321', 'tim').should eql('5543214321@tim.com.br') - #@email.get_sms_address('5543214321', 'oi').should eql('5543214321@sms.oi.com.br') - end - - - + describe "Instantiated" do before(:each) do - @email = Noter.create_emaio + @email = Class.new { include ActiveSms::Email }.new + # @email = Aa.new end it "should be valid" do violated unless @email end - end - - - - # - # it "should clean the number" do - # @email.get_sms_address('5-543-2=14321', 'tim').should eql('5543214321@tim.com.br') - # @email.get_sms_address('55g432g14fd321', 'oi').should eql('5543214321@sms.oi.com.br') - # end + + it "should determine a correct email address" do + @email.get_sms_address('5543214321', 'tim').should eql('5543214321@tim.com.br') + @email.get_sms_address('5543214321', 'oi').should eql('5543214321@sms.oi.com.br') + end + + it "should clean the number" do + @email.get_sms_address('5-543-2=14321', 'tim').should eql('5543214321@tim.com.br') + @email.get_sms_address('55g432g14fd321', 'oi').should eql('5543214321@sms.oi.com.br') + end - # it "should throw an error if the carrier is not known" do - # lambda {@email.get_sms_address('5543214321', 'nofxx-telecom')}.should raise_error(ActiveSms::CarrierException) - # end - # - # it "should throw an error if the carrier is blank" do - # lambda {@email.get_sms_address('5543214321', '')}.should raise_error(ActiveSms::CarrierException) - # end - # - # describe "Email2Sms" do - # it "should throw an error if the carrier is blank" do - # @sms = ActiveSms::Sms.new - # lambda {@email.deliver(@sms)}.should raise_error(ActiveSms::CarrierException) - # end - # end - # - + it "should throw an error if the carrier is not known" do + lambda {@email.get_sms_address('5543214321', 'nofxx-telecom')}.should raise_error(ActiveSms::CarrierException) + end + + it "should throw an error if the carrier is blank" do + lambda {@email.get_sms_address('5543214321', '')}.should raise_error(ActiveSms::CarrierException) + end + + describe "Email2Sms" do + it "should throw an error if the carrier is blank" do + @sms = ActiveSms::Sms.new + lambda {@email.email_deliver(@sms)}.should raise_error(ActiveSms::CarrierException) + end + end + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d9d1948..ea4ed1b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,7 @@ $:.unshift(File.dirname(__FILE__) + '/../lib') $:.unshift(File.dirname(__FILE__) + '/../lib/activesms') $:.unshift(File.dirname(__FILE__) + '/../lib/activesms/connection_adapters') -# require 'activesms/sms' +require 'activesms/sms' require 'activesms' # # require 'activesms/connection_adapters/abstract_adapter'