china_sms 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2ca5471dd6d7293895313bd3900c081019166af
4
- data.tar.gz: 922a28c72cbbd6ff6200b3db56123e91a833673e
3
+ metadata.gz: 5451fdea00e162bca4570ec3e03d6e8c1a7d9585
4
+ data.tar.gz: 982919da3acb9039d0f674e41f47778fa1da9c9c
5
5
  SHA512:
6
- metadata.gz: 0b6a6f1b48d62b0b23c96cebdc9a95c6387fa3a17d20bc3fc548af15162b1f22a471bac9e5dd0966693fcf994f378592e572e1099f9f744c718a32491cb9abeb
7
- data.tar.gz: abd36f9c6c865cbe054b9c833863d2ff8f6c55b19673bee1c6844e7167ce24f459f435859bf5058be09b46195ef12a02e72c34ad828018be75971f43a8349899
6
+ metadata.gz: 119821e27f6959a1b17a48eacecce1fa00f17d9180bfe0118944c5d150935fcc461669d66fa44e130dfc0a9a0f8249cebb89240ff93e6227dc7a146e29cd0134
7
+ data.tar.gz: 6c91a813cf3f8b38e68b2a285273a1f8df88acb714741c7bcafb5a7d9605adb7debf27f013ce3faa9c9becff4ee21448d194416e11a2343153fc52e66e2faeb0
@@ -21,6 +21,10 @@ module ChinaSMS
21
21
  end
22
22
 
23
23
  def to(receiver, content)
24
- @service.to receiver, content, username: @username, password: @password
24
+ @service.to receiver, content, username: @username, password: @password if @service
25
+ end
26
+
27
+ def clear
28
+ @service = @username = @password = nil
25
29
  end
26
30
  end
@@ -1,3 +1,3 @@
1
1
  module ChinaSMS
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,15 +7,25 @@ describe "ChinaSMS" do
7
7
  let(:password) { '666666' }
8
8
  let(:phone) { '13928452841' }
9
9
  let(:content) { '活动通知:深圳 Rubyist 活动时间变更到明天下午 7:00,请留意。' }
10
- before { ChinaSMS.use service, username: username, password: password }
11
- describe "#use" do
12
- subject { ChinaSMS }
13
- its(:username) { should eql "saberma"}
10
+ context 'with service' do
11
+ before { ChinaSMS.use service, username: username, password: password }
12
+ describe "#use" do
13
+ subject { ChinaSMS }
14
+ its(:username) { should eql "saberma"}
15
+ end
16
+ describe "#to" do
17
+ subject { ChinaSMS.to(phone, content) }
18
+ before { ChinaSMS::Service::Tui3.stub(:to).with(phone, content, username: username, password: password).and_return(success: true, code: 0) }
19
+ its([:success]) { should eql true }
20
+ its([:code]) { should eql 0 }
21
+ end
14
22
  end
15
- describe "#to" do
16
- subject { ChinaSMS.to(phone, content) }
17
- before { ChinaSMS::Service::Tui3.stub(:to).with(phone, content, username: username, password: password).and_return(success: true, code: 0) }
18
- its([:success]) { should eql true }
19
- its([:code]) { should eql 0 }
23
+ context 'without service' do
24
+ before { ChinaSMS.clear }
25
+ describe '#to' do
26
+ it 'should be ignore' do
27
+ ChinaSMS.to(phone, content)
28
+ end
29
+ end
20
30
  end
21
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: china_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - saberma