action_smser 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/action_smser/base.rb +1 -1
- data/lib/action_smser/delivery_methods/smstrade.rb +3 -1
- data/lib/action_smser/version.rb +1 -1
- data/test/dummy/config/application.rb +2 -0
- data/test/dummy/config/database.yml +2 -2
- data/test/dummy/config/environments/development.rb +2 -0
- data/test/dummy/config/environments/test.rb +8 -1
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +3 -1
- data/test/dummy/db/tes +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +22 -0
- data/test/dummy/log/test.log +20144 -0
- data/test/functional/action_smser/delivery_reports_controller_test.rb +10 -9
- data/test/integration/navigation_test.rb +1 -1
- data/test/test_helper.rb +6 -5
- data/test/unit/action_smser/base_test.rb +2 -2
- data/test/unit/action_smser/delivery_methods/smstrade_test.rb +17 -2
- metadata +11 -7
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'test_helper'
|
1
|
+
require './test/test_helper'
|
2
2
|
|
3
3
|
class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
4
4
|
|
@@ -33,6 +33,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
33
33
|
|
34
34
|
setup do
|
35
35
|
ActionSmser.delivery_options[:gateway_commit_observers] = []
|
36
|
+
@routes = ActionSmser::Engine.routes
|
36
37
|
end
|
37
38
|
|
38
39
|
test "gateway_commit with existing dr" do
|
@@ -44,7 +45,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
44
45
|
|
45
46
|
SmsTestSetup.expects(:after_gateway_commit).once.with(){|var| var.is_a?(Array) && var.first.is_a?(ActionSmser::DeliveryReport)}
|
46
47
|
|
47
|
-
get 'gateway_commit', :
|
48
|
+
get 'gateway_commit', :gateway => 'test_gateway',
|
48
49
|
"DeliveryReport"=>{"message"=>{"id"=>@msg_id, "donedate"=>"2012/01/03 14:20:45", "sentdate"=>"2012/01/03 14:20:40", "status"=>"DELIVERED"}}
|
49
50
|
|
50
51
|
|
@@ -62,7 +63,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
62
63
|
|
63
64
|
ActionSmser.delivery_options[:gateway_commit] = {'test_gateway' => SmsTestSetup}
|
64
65
|
|
65
|
-
get 'gateway_commit', :
|
66
|
+
get 'gateway_commit', :gateway => 'test_gateway',
|
66
67
|
"DeliveryReport"=>
|
67
68
|
{"message"=>[{"id"=>@msg_id.to_s, "status"=>"DELIVERED"},
|
68
69
|
{"id"=>@msg_id2, "status"=>"DELIVERED"}]}
|
@@ -80,7 +81,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
80
81
|
test "gateway_commit without dr" do
|
81
82
|
ActionSmser.delivery_options[:gateway_commit] = {'test_gateway' => SmsTestSetup}
|
82
83
|
|
83
|
-
get 'gateway_commit', :
|
84
|
+
get 'gateway_commit', :gateway => 'test_gateway',
|
84
85
|
"DeliveryReport"=>{"message"=>{"id"=>"wrongid", "donedate"=>"2012/01/03 14:20:45", "sentdate"=>"2012/01/03 14:20:40", "status"=>"DELIVERED"}}
|
85
86
|
|
86
87
|
assert_response :success
|
@@ -88,7 +89,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
88
89
|
end
|
89
90
|
|
90
91
|
test "gateway_commit without any parser" do
|
91
|
-
get 'gateway_commit', :
|
92
|
+
get 'gateway_commit', :gateway => 'gateway_not_found',
|
92
93
|
"DeliveryReport"=>{"message"=>{"id"=>"wrongid", "donedate"=>"2012/01/03 14:20:45", "sentdate"=>"2012/01/03 14:20:40", "status"=>"DELIVERED"}}
|
93
94
|
|
94
95
|
assert_response :success
|
@@ -97,7 +98,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
97
98
|
|
98
99
|
|
99
100
|
test "index with forbidden admin_access (default access mode)" do
|
100
|
-
get 'index'
|
101
|
+
get 'index'
|
101
102
|
assert_response 403
|
102
103
|
assert_template nil
|
103
104
|
end
|
@@ -109,7 +110,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
109
110
|
ActionSmser::DeliveryReport.create(:msg_id => "idtest_#{rand(10)}")
|
110
111
|
end
|
111
112
|
session[:admin_logged] = true
|
112
|
-
get 'index'
|
113
|
+
get 'index'
|
113
114
|
|
114
115
|
assert_response :success
|
115
116
|
assert_template :index
|
@@ -124,7 +125,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
124
125
|
ActionSmser::DeliveryReport.create(:msg_id => "idtest_#{rand(10)}")
|
125
126
|
end
|
126
127
|
ActionSmser::DeliveryReportsController.any_instance.stubs(:admin_access_only).returns(true)
|
127
|
-
get 'index'
|
128
|
+
get 'index'
|
128
129
|
assert_response :success
|
129
130
|
assert_template :index
|
130
131
|
end
|
@@ -134,7 +135,7 @@ class ActionSmser::DeliveryReportsControllerTest < ActionController::TestCase
|
|
134
135
|
ActionSmser::DeliveryReport.create(:msg_id => "idtest_#{rand(10)}")
|
135
136
|
end
|
136
137
|
ActionSmser::DeliveryReportsController.any_instance.stubs(:admin_access_only).returns(true)
|
137
|
-
get 'list'
|
138
|
+
get 'list'
|
138
139
|
assert_response :success
|
139
140
|
assert_template :list
|
140
141
|
end
|
@@ -4,7 +4,7 @@ class NavigationTest < ActionDispatch::IntegrationTest
|
|
4
4
|
fixtures :all
|
5
5
|
|
6
6
|
test "basic gateway_commit delivery_report" do
|
7
|
-
get 'action_smser/delivery_reports/gateway_commit/example_gateway'
|
7
|
+
get '/action_smser/delivery_reports/gateway_commit/example_gateway'
|
8
8
|
assert_response :success
|
9
9
|
end
|
10
10
|
end
|
data/test/test_helper.rb
CHANGED
@@ -6,17 +6,18 @@ ENV["RAILS_ENV"] = "test"
|
|
6
6
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
7
7
|
require "rails/test_help"
|
8
8
|
require 'minitest/mock'
|
9
|
+
require "mocha/setup"
|
9
10
|
|
10
11
|
Rails.backtrace_cleaner.remove_silencers!
|
11
12
|
|
12
13
|
# Load support files
|
13
14
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
15
|
|
15
|
-
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
|
16
|
-
|
17
|
-
silence_stream(STDOUT) do
|
18
|
-
ActiveRecord::Migrator.migrate File.expand_path('../../db/migrate/', __FILE__)
|
19
|
-
end
|
16
|
+
#ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
|
17
|
+
#
|
18
|
+
#silence_stream(STDOUT) do
|
19
|
+
# ActiveRecord::Migrator.migrate File.expand_path('../../db/migrate/', __FILE__)
|
20
|
+
#end
|
20
21
|
|
21
22
|
#def drop_all_tables
|
22
23
|
# ActiveRecord::Base.connection.tables.each do |table|
|
@@ -18,14 +18,14 @@ class ActionSmser::BaseTest < ActiveSupport::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
setup do
|
21
|
-
@receivers = ["555123555", "123", "+358123555123"]
|
21
|
+
@receivers = ["555123555", "123", "+358123555123", "004915112341234", "04917332341111"]
|
22
22
|
@sender = "555666"
|
23
23
|
@body = "Body with ääkköset end"
|
24
24
|
@sms = MockSms.basic_sms(@receivers, @sender, @body)
|
25
25
|
end
|
26
26
|
|
27
27
|
test "receivers should be joined by commas" do
|
28
|
-
assert_equal "555123555,123,358123555123", @sms.to_encoded
|
28
|
+
assert_equal "555123555,123,358123555123,4915112341234,4917332341111", @sms.to_encoded
|
29
29
|
end
|
30
30
|
|
31
31
|
test "should be ok with single receivers" do
|
@@ -29,6 +29,21 @@ class ActionSmser::SmstradeTest < ActiveSupport::TestCase
|
|
29
29
|
assert_equal 2, @sms_delivery.count
|
30
30
|
end
|
31
31
|
|
32
|
+
test "should only receive numbers not prepended with zeros or plus signs" do
|
33
|
+
prepended_receivers = ["004915112341234", "+4917812341234", "04917332341111"]
|
34
|
+
sms = MockSms.basic_sms(prepended_receivers, @sender, @body)
|
35
|
+
|
36
|
+
assert_equal ["4915112341234", "4917812341234", "4917332341111"], sms.to_numbers_array
|
37
|
+
end
|
38
|
+
|
39
|
+
test "should append 00 to phone numbers before sending" do
|
40
|
+
@receivers.each do |to|
|
41
|
+
ActionSmser::DeliveryMethods::Smstrade.expects(:deliver_path).with(anything(), "00#{to}", anything())
|
42
|
+
end
|
43
|
+
|
44
|
+
sms_delivery = @sms.deliver
|
45
|
+
end
|
46
|
+
|
32
47
|
test "with saving delivery_reports" do
|
33
48
|
@sms.delivery_options[:save_delivery_reports] = true
|
34
49
|
@delivery_reports_count = ActionSmser::DeliveryReport.count
|
@@ -44,10 +59,10 @@ class ActionSmser::SmstradeTest < ActiveSupport::TestCase
|
|
44
59
|
|
45
60
|
@dr1 = @sms_delivery.first
|
46
61
|
assert_equal "smstrade", @dr1.gateway
|
47
|
-
assert_equal "
|
62
|
+
assert_equal "004915112341234", @dr1.to, "receiver wrong"
|
48
63
|
assert_equal "LOCAL_SENT", @dr1.status
|
49
64
|
|
50
65
|
@dr2 = @sms_delivery.last
|
51
|
-
assert_equal "
|
66
|
+
assert_equal "004917812341234", @dr2.to, "receiver wrong"
|
52
67
|
end
|
53
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_smser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olli Huotari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mocha
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '4.
|
61
|
+
version: '4.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '4.
|
68
|
+
version: '4.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: delayed_job
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,9 +141,11 @@ files:
|
|
141
141
|
- test/dummy/config/initializers/wrap_parameters.rb
|
142
142
|
- test/dummy/config/locales/en.yml
|
143
143
|
- test/dummy/config/routes.rb
|
144
|
+
- test/dummy/config/secrets.yml
|
144
145
|
- test/dummy/db/development.sqlite3
|
145
146
|
- test/dummy/db/production.sqlite3
|
146
147
|
- test/dummy/db/schema.rb
|
148
|
+
- test/dummy/db/tes
|
147
149
|
- test/dummy/db/test.sqlite3
|
148
150
|
- test/dummy/log/development.log
|
149
151
|
- test/dummy/log/production.log
|
@@ -183,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
185
|
version: '0'
|
184
186
|
requirements: []
|
185
187
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.4.6
|
187
189
|
signing_key:
|
188
190
|
specification_version: 4
|
189
191
|
summary: ActionSmser == SMS && ActionMailer. Simple way to use SMS (Short Message
|
@@ -210,6 +212,7 @@ test_files:
|
|
210
212
|
- test/dummy/public/404.html
|
211
213
|
- test/dummy/public/favicon.ico
|
212
214
|
- test/dummy/script/rails
|
215
|
+
- test/dummy/db/tes
|
213
216
|
- test/dummy/db/production.sqlite3
|
214
217
|
- test/dummy/db/development.sqlite3
|
215
218
|
- test/dummy/db/test.sqlite3
|
@@ -231,6 +234,7 @@ test_files:
|
|
231
234
|
- test/dummy/config/locales/en.yml
|
232
235
|
- test/dummy/config/environment.rb
|
233
236
|
- test/dummy/config/application.rb
|
237
|
+
- test/dummy/config/secrets.yml
|
234
238
|
- test/dummy/config/boot.rb
|
235
239
|
- test/dummy/config/database.yml
|
236
240
|
- test/dummy/config/environments/production.rb
|