spec/smsified_spec.rb in smsified-0.1.3 vs spec/smsified_spec.rb in smsified-0.1.4

- old
+ new

@@ -25,13 +25,19 @@ it "Should get errors if instantiating without all of the right parameters" do begin Smsified::OneAPI.new 'foobar' rescue => e + e.to_s.should eql 'an options Hash is required' + end + + begin + Smsified::OneAPI.new(:password => nil) + rescue => e e.to_s.should eql ':username required' end - + begin Smsified::OneAPI.new(:username => @username) rescue => e e.to_s.should eql ':password required' end @@ -39,10 +45,16 @@ it "Should raise an error if no :sender_address specified" do begin @one_api.send_sms('foobar') rescue => e + e.to_s.should eql 'an options Hash is required' + end + + begin + @one_api.send_sms({}) + rescue => e e.to_s.should eql ':sender_address is required' end end it "Should not raise an error if a :sender_address was specified at instantiation" do @@ -103,10 +115,16 @@ it "Should get errors if instantiating without all of the right parameters" do begin Smsified::Subscriptions.new 'foobar' rescue => e + e.to_s.should eql 'an options Hash is required' + end + + begin + Smsified::Subscriptions.new({}) + rescue => e e.to_s.should eql ':username required' end begin Smsified::Subscriptions.new(:username => @username) @@ -363,10 +381,16 @@ it "Should get errors if instantiating without all of the right parameters" do begin Smsified::Reporting.new 'foobar' rescue => e + e.to_s.should eql 'an options Hash is required' + end + + begin + Smsified::Reporting.new({}) + rescue => e e.to_s.should eql ':username required' end begin Smsified::Reporting.new(:username => @username) @@ -376,9 +400,15 @@ end it "Should raise an error if no :sender_address specified" do begin @reporting.delivery_status('foobar') + rescue => e + e.to_s.should eql 'an options Hash is required' + end + + begin + @reporting.delivery_status({}) rescue => e e.to_s.should eql ':sender_address is required' end end