sms_aero 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +12 -1
- data/.gitignore +1 -0
- data/.rubocop.yml +19 -0
- data/Gemfile +2 -2
- data/lib/sms_aero/models/sms.rb +6 -6
- data/lib/sms_aero/types/future.rb +1 -1
- data/lib/sms_aero/types/password.rb +5 -0
- data/lib/sms_aero.rb +6 -6
- data/sms_aero.gemspec +1 -1
- data/spec/sms_aero/operations/add_blacklist_spec.rb +24 -33
- data/spec/sms_aero/operations/add_group_spec.rb +26 -35
- data/spec/sms_aero/operations/add_phone_spec.rb +72 -58
- data/spec/sms_aero/operations/check_balance_spec.rb +22 -34
- data/spec/sms_aero/operations/check_groups_spec.rb +21 -33
- data/spec/sms_aero/operations/check_senders_spec.rb +24 -33
- data/spec/sms_aero/operations/check_sending_spec.rb +25 -34
- data/spec/sms_aero/operations/check_sign_spec.rb +24 -33
- data/spec/sms_aero/operations/check_status_spec.rb +25 -34
- data/spec/sms_aero/operations/check_tariff_spec.rb +21 -33
- data/spec/sms_aero/operations/delete_group_spec.rb +24 -33
- data/spec/sms_aero/operations/delete_phone_spec.rb +32 -43
- data/spec/sms_aero/operations/send_sms_spec.rb +64 -57
- data/spec/sms_aero/operations/send_to_group_spec.rb +64 -57
- metadata +2 -1
@@ -8,12 +8,16 @@ RSpec.describe SmsAero, "#check_groups" do
|
|
8
8
|
subject { client.check_groups(params) }
|
9
9
|
|
10
10
|
context "using ssl via POST:" do
|
11
|
-
let(:
|
12
|
-
|
11
|
+
let(:url) do
|
12
|
+
"https://gate.smsaero.ru/checkgroup?" \
|
13
|
+
"answer=json&" \
|
14
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
15
|
+
"user=LOGIN"
|
16
|
+
end
|
13
17
|
|
14
18
|
it "sends a request" do
|
15
19
|
subject
|
16
|
-
expect(a_request(:post,
|
20
|
+
expect(a_request(:post, url)).to have_been_made
|
17
21
|
end
|
18
22
|
|
19
23
|
it "returns success" do
|
@@ -23,50 +27,34 @@ RSpec.describe SmsAero, "#check_groups" do
|
|
23
27
|
end
|
24
28
|
|
25
29
|
context "via GET:" do
|
26
|
-
let(:
|
27
|
-
|
30
|
+
let(:url) do
|
31
|
+
"https://gate.smsaero.ru/checkgroup?" \
|
32
|
+
"answer=json&" \
|
33
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
34
|
+
"user=LOGIN"
|
35
|
+
end
|
28
36
|
|
29
37
|
before { settings[:use_post] = false }
|
30
38
|
|
31
39
|
it "sends a request" do
|
32
40
|
subject
|
33
|
-
expect(a_request(:get,
|
41
|
+
expect(a_request(:get, url)).to have_been_made
|
34
42
|
end
|
35
43
|
end
|
36
44
|
|
37
45
|
context "not using ssl:" do
|
38
|
-
let(:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
it "sends a request" do
|
44
|
-
subject
|
45
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
46
|
+
let(:url) do
|
47
|
+
"http://gate.smsaero.ru/checkgroup?" \
|
48
|
+
"answer=json&" \
|
49
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
50
|
+
"user=LOGIN"
|
46
51
|
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "with custom user:" do
|
50
|
-
let(:host) { "https://gate.smsaero.ru/checkgroup" }
|
51
|
-
let(:query) { "answer=json&password=PASSWORD&user=USER" }
|
52
52
|
|
53
|
-
before {
|
54
|
-
|
55
|
-
it "sends a request" do
|
56
|
-
subject
|
57
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with custom password:" do
|
62
|
-
let(:host) { "https://gate.smsaero.ru/checkgroup" }
|
63
|
-
let(:query) { "answer=json&password=PSWD&user=LOGIN" }
|
64
|
-
|
65
|
-
before { params[:password] = "PSWD" }
|
53
|
+
before { settings[:use_ssl] = false }
|
66
54
|
|
67
55
|
it "sends a request" do
|
68
56
|
subject
|
69
|
-
expect(a_request(:post,
|
57
|
+
expect(a_request(:post, url)).to have_been_made
|
70
58
|
end
|
71
59
|
end
|
72
60
|
end
|
@@ -8,12 +8,17 @@ RSpec.describe SmsAero, "#check_senders" do
|
|
8
8
|
subject { client.check_senders(params) }
|
9
9
|
|
10
10
|
context "using ssl via POST:" do
|
11
|
-
let(:
|
12
|
-
|
11
|
+
let(:url) do
|
12
|
+
"https://gate.smsaero.ru/senders?" \
|
13
|
+
"answer=json&" \
|
14
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
15
|
+
"sign=baz&" \
|
16
|
+
"user=LOGIN"
|
17
|
+
end
|
13
18
|
|
14
19
|
it "sends a request" do
|
15
20
|
subject
|
16
|
-
expect(a_request(:post,
|
21
|
+
expect(a_request(:post, url)).to have_been_made
|
17
22
|
end
|
18
23
|
|
19
24
|
it "returns success" do
|
@@ -23,50 +28,36 @@ RSpec.describe SmsAero, "#check_senders" do
|
|
23
28
|
end
|
24
29
|
|
25
30
|
context "via GET:" do
|
26
|
-
let(:
|
27
|
-
|
31
|
+
let(:url) do
|
32
|
+
"https://gate.smsaero.ru/senders?" \
|
33
|
+
"answer=json&" \
|
34
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
35
|
+
"sign=baz&" \
|
36
|
+
"user=LOGIN"
|
37
|
+
end
|
28
38
|
|
29
39
|
before { settings[:use_post] = false }
|
30
40
|
|
31
41
|
it "sends a request" do
|
32
42
|
subject
|
33
|
-
expect(a_request(:get,
|
43
|
+
expect(a_request(:get, url)).to have_been_made
|
34
44
|
end
|
35
45
|
end
|
36
46
|
|
37
47
|
context "not using ssl:" do
|
38
|
-
let(:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
subject
|
45
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
48
|
+
let(:url) do
|
49
|
+
"http://gate.smsaero.ru/senders?" \
|
50
|
+
"answer=json&" \
|
51
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
52
|
+
"sign=baz&" \
|
53
|
+
"user=LOGIN"
|
46
54
|
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "with custom user:" do
|
50
|
-
let(:host) { "https://gate.smsaero.ru/senders" }
|
51
|
-
let(:query) { "answer=json&password=PASSWORD&sign=baz&user=USER" }
|
52
55
|
|
53
|
-
before {
|
54
|
-
|
55
|
-
it "sends a request" do
|
56
|
-
subject
|
57
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with custom password:" do
|
62
|
-
let(:host) { "https://gate.smsaero.ru/senders" }
|
63
|
-
let(:query) { "answer=json&password=PSWD&sign=baz&user=LOGIN" }
|
64
|
-
|
65
|
-
before { params[:password] = "PSWD" }
|
56
|
+
before { settings[:use_ssl] = false }
|
66
57
|
|
67
58
|
it "sends a request" do
|
68
59
|
subject
|
69
|
-
expect(a_request(:post,
|
60
|
+
expect(a_request(:post, url)).to have_been_made
|
70
61
|
end
|
71
62
|
end
|
72
63
|
|
@@ -1,19 +1,24 @@
|
|
1
1
|
RSpec.describe SmsAero, "#check_sending" do
|
2
2
|
let(:settings) { { user: "LOGIN", password: "PASSWORD" } }
|
3
3
|
let(:client) { described_class.new(settings) }
|
4
|
-
let(:params) { { id:
|
4
|
+
let(:params) { { id: "foobar" } }
|
5
5
|
let(:answer) { { result: "accepted" } }
|
6
6
|
|
7
7
|
before { stub_request(:any, //).to_return(body: answer.to_json) }
|
8
8
|
subject { client.check_sending(params) }
|
9
9
|
|
10
10
|
context "using ssl via POST:" do
|
11
|
-
let(:
|
12
|
-
|
11
|
+
let(:url) do
|
12
|
+
"https://gate.smsaero.ru/checksending?" \
|
13
|
+
"answer=json&" \
|
14
|
+
"id=foobar&" \
|
15
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
16
|
+
"user=LOGIN"
|
17
|
+
end
|
13
18
|
|
14
19
|
it "sends a request" do
|
15
20
|
subject
|
16
|
-
expect(a_request(:post,
|
21
|
+
expect(a_request(:post, url)).to have_been_made
|
17
22
|
end
|
18
23
|
|
19
24
|
it "returns success" do
|
@@ -23,50 +28,36 @@ RSpec.describe SmsAero, "#check_sending" do
|
|
23
28
|
end
|
24
29
|
|
25
30
|
context "via GET:" do
|
26
|
-
let(:
|
27
|
-
|
31
|
+
let(:url) do
|
32
|
+
"https://gate.smsaero.ru/checksending?" \
|
33
|
+
"answer=json&" \
|
34
|
+
"id=foobar&" \
|
35
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
36
|
+
"user=LOGIN"
|
37
|
+
end
|
28
38
|
|
29
39
|
before { settings[:use_post] = false }
|
30
40
|
|
31
41
|
it "sends a request" do
|
32
42
|
subject
|
33
|
-
expect(a_request(:get,
|
43
|
+
expect(a_request(:get, url)).to have_been_made
|
34
44
|
end
|
35
45
|
end
|
36
46
|
|
37
47
|
context "not using ssl:" do
|
38
|
-
let(:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
subject
|
45
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
48
|
+
let(:url) do
|
49
|
+
"http://gate.smsaero.ru/checksending?" \
|
50
|
+
"answer=json&" \
|
51
|
+
"id=foobar&" \
|
52
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
53
|
+
"user=LOGIN"
|
46
54
|
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "with custom user:" do
|
50
|
-
let(:host) { "https://gate.smsaero.ru/checksending" }
|
51
|
-
let(:query) { "answer=json&id=foobar&password=PASSWORD&user=USER" }
|
52
55
|
|
53
|
-
before {
|
54
|
-
|
55
|
-
it "sends a request" do
|
56
|
-
subject
|
57
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with custom password:" do
|
62
|
-
let(:host) { "https://gate.smsaero.ru/checksending" }
|
63
|
-
let(:query) { "answer=json&id=foobar&password=PSWD&user=LOGIN" }
|
64
|
-
|
65
|
-
before { params[:password] = "PSWD" }
|
56
|
+
before { settings[:use_ssl] = false }
|
66
57
|
|
67
58
|
it "sends a request" do
|
68
59
|
subject
|
69
|
-
expect(a_request(:post,
|
60
|
+
expect(a_request(:post, url)).to have_been_made
|
70
61
|
end
|
71
62
|
end
|
72
63
|
|
@@ -8,12 +8,17 @@ RSpec.describe SmsAero, "#check_sign" do
|
|
8
8
|
subject { client.check_sign(params) }
|
9
9
|
|
10
10
|
context "using ssl via POST:" do
|
11
|
-
let(:
|
12
|
-
|
11
|
+
let(:url) do
|
12
|
+
"https://gate.smsaero.ru/sign?" \
|
13
|
+
"answer=json&" \
|
14
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
15
|
+
"sign=foo&" \
|
16
|
+
"user=LOGIN"
|
17
|
+
end
|
13
18
|
|
14
19
|
it "sends a request" do
|
15
20
|
subject
|
16
|
-
expect(a_request(:post,
|
21
|
+
expect(a_request(:post, url)).to have_been_made
|
17
22
|
end
|
18
23
|
|
19
24
|
it "returns statuses" do
|
@@ -22,50 +27,36 @@ RSpec.describe SmsAero, "#check_sign" do
|
|
22
27
|
end
|
23
28
|
|
24
29
|
context "via GET:" do
|
25
|
-
let(:
|
26
|
-
|
30
|
+
let(:url) do
|
31
|
+
"https://gate.smsaero.ru/sign?" \
|
32
|
+
"answer=json&" \
|
33
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
34
|
+
"sign=foo&" \
|
35
|
+
"user=LOGIN"
|
36
|
+
end
|
27
37
|
|
28
38
|
before { settings[:use_post] = false }
|
29
39
|
|
30
40
|
it "sends a request" do
|
31
41
|
subject
|
32
|
-
expect(a_request(:get,
|
42
|
+
expect(a_request(:get, url)).to have_been_made
|
33
43
|
end
|
34
44
|
end
|
35
45
|
|
36
46
|
context "not using ssl:" do
|
37
|
-
let(:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
subject
|
44
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
47
|
+
let(:url) do
|
48
|
+
"http://gate.smsaero.ru/sign?" \
|
49
|
+
"answer=json&" \
|
50
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
51
|
+
"sign=foo&" \
|
52
|
+
"user=LOGIN"
|
45
53
|
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "with custom user:" do
|
49
|
-
let(:host) { "https://gate.smsaero.ru/sign" }
|
50
|
-
let(:query) { "answer=json&password=PASSWORD&sign=foo&user=USER" }
|
51
54
|
|
52
|
-
before {
|
53
|
-
|
54
|
-
it "sends a request" do
|
55
|
-
subject
|
56
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "with custom password:" do
|
61
|
-
let(:host) { "https://gate.smsaero.ru/sign" }
|
62
|
-
let(:query) { "answer=json&password=PSWD&sign=foo&user=LOGIN" }
|
63
|
-
|
64
|
-
before { params[:password] = "PSWD" }
|
55
|
+
before { settings[:use_ssl] = false }
|
65
56
|
|
66
57
|
it "sends a request" do
|
67
58
|
subject
|
68
|
-
expect(a_request(:post,
|
59
|
+
expect(a_request(:post, url)).to have_been_made
|
69
60
|
end
|
70
61
|
end
|
71
62
|
|
@@ -1,19 +1,24 @@
|
|
1
1
|
RSpec.describe SmsAero, "#check_status" do
|
2
2
|
let(:settings) { { user: "LOGIN", password: "PASSWORD" } }
|
3
3
|
let(:client) { described_class.new(settings) }
|
4
|
-
let(:params) { { id:
|
4
|
+
let(:params) { { id: "foobar" } }
|
5
5
|
let(:answer) { { result: "accepted" } }
|
6
6
|
|
7
7
|
before { stub_request(:any, //).to_return(body: answer.to_json) }
|
8
8
|
subject { client.check_status(params) }
|
9
9
|
|
10
10
|
context "using ssl via POST:" do
|
11
|
-
let(:
|
12
|
-
|
11
|
+
let(:url) do
|
12
|
+
"https://gate.smsaero.ru/status?" \
|
13
|
+
"answer=json&" \
|
14
|
+
"id=foobar&" \
|
15
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
16
|
+
"user=LOGIN"
|
17
|
+
end
|
13
18
|
|
14
19
|
it "sends a request" do
|
15
20
|
subject
|
16
|
-
expect(a_request(:post,
|
21
|
+
expect(a_request(:post, url)).to have_been_made
|
17
22
|
end
|
18
23
|
|
19
24
|
it "returns success" do
|
@@ -23,50 +28,36 @@ RSpec.describe SmsAero, "#check_status" do
|
|
23
28
|
end
|
24
29
|
|
25
30
|
context "via GET:" do
|
26
|
-
let(:
|
27
|
-
|
31
|
+
let(:url) do
|
32
|
+
"https://gate.smsaero.ru/status?" \
|
33
|
+
"answer=json&" \
|
34
|
+
"id=foobar&" \
|
35
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
36
|
+
"user=LOGIN"
|
37
|
+
end
|
28
38
|
|
29
39
|
before { settings[:use_post] = false }
|
30
40
|
|
31
41
|
it "sends a request" do
|
32
42
|
subject
|
33
|
-
expect(a_request(:get,
|
43
|
+
expect(a_request(:get, url)).to have_been_made
|
34
44
|
end
|
35
45
|
end
|
36
46
|
|
37
47
|
context "not using ssl:" do
|
38
|
-
let(:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
subject
|
45
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
48
|
+
let(:url) do
|
49
|
+
"http://gate.smsaero.ru/status?" \
|
50
|
+
"answer=json&" \
|
51
|
+
"id=foobar&" \
|
52
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
53
|
+
"user=LOGIN"
|
46
54
|
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "with custom user:" do
|
50
|
-
let(:host) { "https://gate.smsaero.ru/status" }
|
51
|
-
let(:query) { "answer=json&id=foobar&password=PASSWORD&user=USER" }
|
52
55
|
|
53
|
-
before {
|
54
|
-
|
55
|
-
it "sends a request" do
|
56
|
-
subject
|
57
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with custom password:" do
|
62
|
-
let(:host) { "https://gate.smsaero.ru/status" }
|
63
|
-
let(:query) { "answer=json&id=foobar&password=PSWD&user=LOGIN" }
|
64
|
-
|
65
|
-
before { params[:password] = "PSWD" }
|
56
|
+
before { settings[:use_ssl] = false }
|
66
57
|
|
67
58
|
it "sends a request" do
|
68
59
|
subject
|
69
|
-
expect(a_request(:post,
|
60
|
+
expect(a_request(:post, url)).to have_been_made
|
70
61
|
end
|
71
62
|
end
|
72
63
|
|
@@ -8,12 +8,16 @@ RSpec.describe SmsAero, "#check_tariff" do
|
|
8
8
|
subject { client.check_tariff(params) }
|
9
9
|
|
10
10
|
context "using ssl via POST:" do
|
11
|
-
let(:
|
12
|
-
|
11
|
+
let(:url) do
|
12
|
+
"https://gate.smsaero.ru/checktarif?" \
|
13
|
+
"answer=json&" \
|
14
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
15
|
+
"user=LOGIN"
|
16
|
+
end
|
13
17
|
|
14
18
|
it "sends a request" do
|
15
19
|
subject
|
16
|
-
expect(a_request(:post,
|
20
|
+
expect(a_request(:post, url)).to have_been_made
|
17
21
|
end
|
18
22
|
|
19
23
|
it "returns statuses" do
|
@@ -23,50 +27,34 @@ RSpec.describe SmsAero, "#check_tariff" do
|
|
23
27
|
end
|
24
28
|
|
25
29
|
context "via GET:" do
|
26
|
-
let(:
|
27
|
-
|
30
|
+
let(:url) do
|
31
|
+
"https://gate.smsaero.ru/checktarif?" \
|
32
|
+
"answer=json&" \
|
33
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
34
|
+
"user=LOGIN"
|
35
|
+
end
|
28
36
|
|
29
37
|
before { settings[:use_post] = false }
|
30
38
|
|
31
39
|
it "sends a request" do
|
32
40
|
subject
|
33
|
-
expect(a_request(:get,
|
41
|
+
expect(a_request(:get, url)).to have_been_made
|
34
42
|
end
|
35
43
|
end
|
36
44
|
|
37
45
|
context "not using ssl:" do
|
38
|
-
let(:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
it "sends a request" do
|
44
|
-
subject
|
45
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
46
|
+
let(:url) do
|
47
|
+
"http://gate.smsaero.ru/checktarif?" \
|
48
|
+
"answer=json&" \
|
49
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
50
|
+
"user=LOGIN"
|
46
51
|
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "with custom user:" do
|
50
|
-
let(:host) { "https://gate.smsaero.ru/checktarif" }
|
51
|
-
let(:query) { "answer=json&password=PASSWORD&user=USER" }
|
52
52
|
|
53
|
-
before {
|
54
|
-
|
55
|
-
it "sends a request" do
|
56
|
-
subject
|
57
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with custom password:" do
|
62
|
-
let(:host) { "https://gate.smsaero.ru/checktarif" }
|
63
|
-
let(:query) { "answer=json&password=PSWD&user=LOGIN" }
|
64
|
-
|
65
|
-
before { params[:password] = "PSWD" }
|
53
|
+
before { settings[:use_ssl] = false }
|
66
54
|
|
67
55
|
it "sends a request" do
|
68
56
|
subject
|
69
|
-
expect(a_request(:post,
|
57
|
+
expect(a_request(:post, url)).to have_been_made
|
70
58
|
end
|
71
59
|
end
|
72
60
|
end
|
@@ -8,12 +8,17 @@ RSpec.describe SmsAero, "#delete_group" do
|
|
8
8
|
subject { client.delete_group(params) }
|
9
9
|
|
10
10
|
context "using ssl via POST:" do
|
11
|
-
let(:
|
12
|
-
|
11
|
+
let(:url) do
|
12
|
+
"https://gate.smsaero.ru/delgroup?" \
|
13
|
+
"answer=json&" \
|
14
|
+
"group=foobar&" \
|
15
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
16
|
+
"user=LOGIN"
|
17
|
+
end
|
13
18
|
|
14
19
|
it "sends a request" do
|
15
20
|
subject
|
16
|
-
expect(a_request(:post,
|
21
|
+
expect(a_request(:post, url)).to have_been_made
|
17
22
|
end
|
18
23
|
|
19
24
|
it "returns success" do
|
@@ -23,50 +28,36 @@ RSpec.describe SmsAero, "#delete_group" do
|
|
23
28
|
end
|
24
29
|
|
25
30
|
context "via GET:" do
|
26
|
-
let(:
|
27
|
-
|
31
|
+
let(:url) do
|
32
|
+
"https://gate.smsaero.ru/delgroup?" \
|
33
|
+
"answer=json&" \
|
34
|
+
"group=foobar&" \
|
35
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
36
|
+
"user=LOGIN"
|
37
|
+
end
|
28
38
|
|
29
39
|
before { settings[:use_post] = false }
|
30
40
|
|
31
41
|
it "sends a request" do
|
32
42
|
subject
|
33
|
-
expect(a_request(:get,
|
43
|
+
expect(a_request(:get, url)).to have_been_made
|
34
44
|
end
|
35
45
|
end
|
36
46
|
|
37
47
|
context "not using ssl:" do
|
38
|
-
let(:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
subject
|
45
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
48
|
+
let(:url) do
|
49
|
+
"http://gate.smsaero.ru/delgroup?" \
|
50
|
+
"answer=json&" \
|
51
|
+
"group=foobar&" \
|
52
|
+
"password=319f4d26e3c536b5dd871bb2c52e3178&" \
|
53
|
+
"user=LOGIN"
|
46
54
|
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "with custom user:" do
|
50
|
-
let(:host) { "https://gate.smsaero.ru/delgroup" }
|
51
|
-
let(:query) { "answer=json&group=foobar&password=PASSWORD&user=USER" }
|
52
55
|
|
53
|
-
before {
|
54
|
-
|
55
|
-
it "sends a request" do
|
56
|
-
subject
|
57
|
-
expect(a_request(:post, "#{host}?#{query}")).to have_been_made
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with custom password:" do
|
62
|
-
let(:host) { "https://gate.smsaero.ru/delgroup" }
|
63
|
-
let(:query) { "answer=json&group=foobar&password=PSWD&user=LOGIN" }
|
64
|
-
|
65
|
-
before { params[:password] = "PSWD" }
|
56
|
+
before { settings[:use_ssl] = false }
|
66
57
|
|
67
58
|
it "sends a request" do
|
68
59
|
subject
|
69
|
-
expect(a_request(:post,
|
60
|
+
expect(a_request(:post, url)).to have_been_made
|
70
61
|
end
|
71
62
|
end
|
72
63
|
|