short_message 0.1.0 → 1.0.0
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 +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +18 -10
- data/Rakefile +18 -8
- data/app/controllers/short_message/application_controller.rb +1 -0
- data/app/controllers/short_message/messages_controller.rb +20 -0
- data/app/mailers/application_mailer.rb +3 -0
- data/app/mailers/short_message/mailer.rb +5 -15
- data/app/models/short_message/message.rb +27 -61
- data/config/routes.rb +5 -1
- data/db/migrate/20130308133457_create_short_message_messages.rb +1 -1
- data/lib/generators/short_message/templates/config/initializers/short_message.rb +10 -10
- data/lib/generators/short_message/templates/config/locales/short_message.de.yml +5 -11
- data/lib/generators/short_message/templates/config/locales/short_message.en.yml +5 -11
- data/lib/short_message/config.rb +3 -4
- data/lib/short_message/engine.rb +3 -4
- data/lib/short_message/version.rb +1 -1
- data/test/dummy/README.rdoc +28 -0
- data/{spec → test}/dummy/Rakefile +1 -2
- data/{spec → test}/dummy/app/assets/javascripts/application.js +4 -6
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/{spec → test}/dummy/app/helpers/application_helper.rb +0 -0
- data/{spec → test}/dummy/app/views/layouts/application.html.erb +1 -2
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +54 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/{spec → test}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/{spec → test}/dummy/config/initializers/inflections.rb +6 -5
- data/{spec → test}/dummy/config/initializers/mime_types.rb +0 -1
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/{spec → test}/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/test/dummy/config/locales/en.yml +23 -0
- data/{spec → test}/dummy/config/routes.rb +0 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/{spec/dummy/public/favicon.ico → test/dummy/log/development.log} +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/short_message_test.rb +7 -0
- data/test/test_helper.rb +21 -0
- metadata +87 -164
- data/spec/config_helper.rb +0 -15
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/config/application.rb +0 -65
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.example.yml +0 -42
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/locales/short_message.de.yml +0 -14
- data/spec/dummy/config/locales/short_message.en.yml +0 -14
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/script/rails +0 -6
- data/spec/factories/short_message_messages.rb +0 -17
- data/spec/mailers/short_message/mailer_spec.rb +0 -64
- data/spec/models/short_message/config_spec.rb +0 -17
- data/spec/models/short_message/message_spec.rb +0 -52
- data/spec/spec_helper.rb +0 -21
data/spec/dummy/config/boot.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# MySQL. Versions 4.1 and 5.0 are recommended.
|
2
|
-
#
|
3
|
-
# Install the MYSQL driver
|
4
|
-
# gem install mysql2
|
5
|
-
#
|
6
|
-
# Ensure the MySQL gem is defined in your Gemfile
|
7
|
-
# gem 'mysql2'
|
8
|
-
#
|
9
|
-
# And be sure to use new-style password hashing:
|
10
|
-
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
|
11
|
-
development:
|
12
|
-
adapter: mysql2
|
13
|
-
encoding: utf8
|
14
|
-
reconnect: false
|
15
|
-
database: dummy_development
|
16
|
-
pool: 5
|
17
|
-
username: root
|
18
|
-
password:
|
19
|
-
socket: /tmp/mysql.sock
|
20
|
-
|
21
|
-
# Warning: The database defined as "test" will be erased and
|
22
|
-
# re-generated from your development database when you run "rake".
|
23
|
-
# Do not set this db to the same as development or production.
|
24
|
-
test:
|
25
|
-
adapter: mysql2
|
26
|
-
encoding: utf8
|
27
|
-
reconnect: false
|
28
|
-
database: dummy_test
|
29
|
-
pool: 5
|
30
|
-
username: root
|
31
|
-
password:
|
32
|
-
socket: /tmp/mysql.sock
|
33
|
-
|
34
|
-
production:
|
35
|
-
adapter: mysql2
|
36
|
-
encoding: utf8
|
37
|
-
reconnect: false
|
38
|
-
database: dummy_production
|
39
|
-
pool: 5
|
40
|
-
username: root
|
41
|
-
password:
|
42
|
-
socket: /tmp/mysql.sock
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Only use best-standards-support built into browsers
|
23
|
-
config.action_dispatch.best_standards_support = :builtin
|
24
|
-
|
25
|
-
# Raise exception on mass assignment protection for Active Record models
|
26
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
27
|
-
|
28
|
-
# Log the query plan for queries taking more than this (works
|
29
|
-
# with SQLite, MySQL, and PostgreSQL)
|
30
|
-
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
31
|
-
|
32
|
-
# Do not compress assets
|
33
|
-
config.assets.compress = false
|
34
|
-
|
35
|
-
# Expands the lines which load the assets
|
36
|
-
config.assets.debug = true
|
37
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# Code is not reloaded between requests
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Full error reports are disabled and caching is turned on
|
8
|
-
config.consider_all_requests_local = false
|
9
|
-
config.action_controller.perform_caching = true
|
10
|
-
|
11
|
-
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.serve_static_assets = false
|
13
|
-
|
14
|
-
# Compress JavaScripts and CSS
|
15
|
-
config.assets.compress = true
|
16
|
-
|
17
|
-
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
-
config.assets.compile = false
|
19
|
-
|
20
|
-
# Generate digests for assets URLs
|
21
|
-
config.assets.digest = true
|
22
|
-
|
23
|
-
# Defaults to nil and saved in location specified by config.assets.prefix
|
24
|
-
# config.assets.manifest = YOUR_PATH
|
25
|
-
|
26
|
-
# Specifies the header that your server uses for sending files
|
27
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
-
|
30
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
-
# config.force_ssl = true
|
32
|
-
|
33
|
-
# See everything in the log (default is :info)
|
34
|
-
# config.log_level = :debug
|
35
|
-
|
36
|
-
# Prepend all log lines with the following tags
|
37
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
38
|
-
|
39
|
-
# Use a different logger for distributed setups
|
40
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
|
-
|
42
|
-
# Use a different cache store in production
|
43
|
-
# config.cache_store = :mem_cache_store
|
44
|
-
|
45
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
46
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
47
|
-
|
48
|
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
49
|
-
# config.assets.precompile += %w( search.js )
|
50
|
-
|
51
|
-
# Disable delivery errors, bad email addresses will be ignored
|
52
|
-
# config.action_mailer.raise_delivery_errors = false
|
53
|
-
|
54
|
-
# Enable threaded mode
|
55
|
-
# config.threadsafe!
|
56
|
-
|
57
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
-
# the I18n.default_locale when a translation can not be found)
|
59
|
-
config.i18n.fallbacks = true
|
60
|
-
|
61
|
-
# Send deprecation notices to registered listeners
|
62
|
-
config.active_support.deprecation = :notify
|
63
|
-
|
64
|
-
# Log the query plan for queries taking more than this (works
|
65
|
-
# with SQLite, MySQL, and PostgreSQL)
|
66
|
-
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
67
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Configure static asset server for tests with Cache-Control for performance
|
11
|
-
config.serve_static_assets = true
|
12
|
-
config.static_cache_control = "public, max-age=3600"
|
13
|
-
|
14
|
-
# Log error messages when you accidentally call methods on nil
|
15
|
-
config.whiny_nils = true
|
16
|
-
|
17
|
-
# Show full error reports and disable caching
|
18
|
-
config.consider_all_requests_local = true
|
19
|
-
config.action_controller.perform_caching = false
|
20
|
-
|
21
|
-
# Raise exceptions instead of rendering exception templates
|
22
|
-
config.action_dispatch.show_exceptions = false
|
23
|
-
|
24
|
-
# Disable request forgery protection in test environment
|
25
|
-
config.action_controller.allow_forgery_protection = false
|
26
|
-
|
27
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
-
# The :test delivery method accumulates sent emails in the
|
29
|
-
# ActionMailer::Base.deliveries array.
|
30
|
-
config.action_mailer.delivery_method = :test
|
31
|
-
|
32
|
-
# Raise exception on mass assignment protection for Active Record models
|
33
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
34
|
-
|
35
|
-
# Print deprecation notices to the stderr
|
36
|
-
config.active_support.deprecation = :stderr
|
37
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token = '381fe2c22f30e7ee6c66cea42ed238b2cc1c69647f1474894d1c9d596f3a47296721103feadb780b08816b51b37fa4a0c5952252266053f4b3fefb18d01b672d'
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rails generate session_migration")
|
8
|
-
# Dummy::Application.config.session_store :active_record_store
|
@@ -1,14 +0,0 @@
|
|
1
|
-
de:
|
2
|
-
short_message:
|
3
|
-
status:
|
4
|
-
code_1: "Empfänger abwesend"
|
5
|
-
code_3: "anerkannt"
|
6
|
-
code_5: "anruf blockiert"
|
7
|
-
code_6: "MSC Fehler"
|
8
|
-
code_7: "zugestellt"
|
9
|
-
code_18: "abgewiesen"
|
10
|
-
code_20: "nicht verfügbar während Roaming"
|
11
|
-
code_21: "unerwarteter Wert"
|
12
|
-
code_22: "unbekannter Abonnent"
|
13
|
-
code_99: "Aufladen fehlgeschlagen"
|
14
|
-
code_999: "unkategorisierter Status"
|
@@ -1,14 +0,0 @@
|
|
1
|
-
en:
|
2
|
-
short_message:
|
3
|
-
status:
|
4
|
-
code_1: "absent subscriber"
|
5
|
-
code_3: "accepted"
|
6
|
-
code_5: "call barred"
|
7
|
-
code_6: "controlling MSC failure"
|
8
|
-
code_7: "delivered"
|
9
|
-
code_18: "rejected by gateway"
|
10
|
-
code_20: "unavailable while roaming to"
|
11
|
-
code_21: "unexpected data value"
|
12
|
-
code_22: "unknown subscriber"
|
13
|
-
code_99: "recharge failed"
|
14
|
-
code_999: "uncategorized status"
|
data/spec/dummy/config.ru
DELETED
data/spec/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/spec/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/spec/dummy/public/500.html
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
</div>
|
24
|
-
</body>
|
25
|
-
</html>
|
data/spec/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Read about factories at https://github.com/thoughtbot/factory_girl
|
2
|
-
|
3
|
-
FactoryGirl.define do
|
4
|
-
factory :short_message_message, :class => 'Message' do
|
5
|
-
message_key "MyString"
|
6
|
-
sender "MyString"
|
7
|
-
recipient "MyString"
|
8
|
-
status_code 1
|
9
|
-
text "MyText"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
FactoryGirl.define do
|
14
|
-
factory :message, class: ShortMessage::Message do
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module ShortMessage
|
4
|
-
describe Mailer do
|
5
|
-
describe "reload notification" do
|
6
|
-
ShortMessage.configure do |config|
|
7
|
-
config.reload_notification_email = "webmaster@your-domain.com"
|
8
|
-
config.default_mail_sender = "webmaster@your-domain.com"
|
9
|
-
end
|
10
|
-
|
11
|
-
amount = 20
|
12
|
-
|
13
|
-
let(:mail) { ShortMessage::Mailer.recharge_notification amount }
|
14
|
-
|
15
|
-
it "renders the subject" do
|
16
|
-
mail.subject.should == "SMS credit recharged"
|
17
|
-
end
|
18
|
-
|
19
|
-
it "renders the sender email" do
|
20
|
-
mail.from.should == ["webmaster@your-domain.com"]
|
21
|
-
end
|
22
|
-
|
23
|
-
it "renders the recipient email" do
|
24
|
-
mail.to.should == ["webmaster@your-domain.com"]
|
25
|
-
end
|
26
|
-
|
27
|
-
it "contains the amount in the body" do
|
28
|
-
mail.body.encoded.should match(amount.to_s)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "voucher notification" do
|
33
|
-
ShortMessage.configure do |config|
|
34
|
-
config.user_id = "123456789abcdefghijklmnopq"
|
35
|
-
config.voucher_notification_email = "give-me-money@your-domain.com"
|
36
|
-
config.default_mail_sender = "webmaster@your-domain.com"
|
37
|
-
end
|
38
|
-
|
39
|
-
amount = 20
|
40
|
-
|
41
|
-
let(:mail) { ShortMessage::Mailer.voucher_notification amount }
|
42
|
-
|
43
|
-
it "renders the subject" do
|
44
|
-
mail.subject.should == "SMS credit recharged, please create a voucher"
|
45
|
-
end
|
46
|
-
|
47
|
-
it "renders the sender email" do
|
48
|
-
mail.from.should == ["webmaster@your-domain.com"]
|
49
|
-
end
|
50
|
-
|
51
|
-
it "renders the recipient email" do
|
52
|
-
mail.to.should == ["give-me-money@your-domain.com"]
|
53
|
-
end
|
54
|
-
|
55
|
-
it "contains the amount in the body" do
|
56
|
-
mail.body.encoded.should match(amount.to_s)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "contains the customer in the body" do
|
60
|
-
mail.body.encoded.should match(amount.to_s)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module ShortMessage
|
4
|
-
describe "Config" do
|
5
|
-
include ConfigHelper
|
6
|
-
|
7
|
-
it "is accessible" do
|
8
|
-
ShortMessage.should respond_to :configure
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
it "renders the id string" do
|
13
|
-
load_default_config
|
14
|
-
ShortMessage.config.id_string.should == "123456789abcdefghijklmnopq"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
module ShortMessage
|
5
|
-
describe "Status Text 1 EN" do
|
6
|
-
it "responds with full english text" do
|
7
|
-
I18n.locale = :en
|
8
|
-
FactoryGirl.build(:message, :status_code => 1).status_text.should == "delivered"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "Status Text 1 DE" do
|
13
|
-
it "responds with full german text" do
|
14
|
-
I18n.locale = :de
|
15
|
-
FactoryGirl.build(:message, :status_code => 1).status_text.should == "zugestellt"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "Status Text 100 EN" do
|
20
|
-
it "responds with full english text" do
|
21
|
-
I18n.locale = :en
|
22
|
-
FactoryGirl.build(:message, :status_code => 100).status_text.should == "created"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "Status Text 100 DE" do
|
27
|
-
it "responds with full german text" do
|
28
|
-
I18n.locale = :de
|
29
|
-
FactoryGirl.build(:message, :status_code => 100).status_text.should == "erstellt"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "deliver params array" do
|
34
|
-
include ConfigHelper
|
35
|
-
|
36
|
-
it "generates smoothly" do
|
37
|
-
load_default_config
|
38
|
-
message = FactoryGirl.build(:message, :sender => "0041791234567", :recipient => "0041799876543", :text => "test ä&!")
|
39
|
-
|
40
|
-
message.send(:build_deliver_params_string).should == "UserID=1234&CCUID=1234&ID=123456789abcdefghijklmnopq&sender=0041791234567&receipient=0041799876543&message=test+%E4%26%21"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "recharge params array" do
|
45
|
-
include ConfigHelper
|
46
|
-
|
47
|
-
it "generates smoothly" do
|
48
|
-
load_default_config
|
49
|
-
Message.new.send(:build_recharge_params_string, 20).should == "UserIDFS=1234&CCUID=1234&pay=1&amount=20&idstring=123456789abcdefghijklmnopq"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] ||= 'test'
|
2
|
-
|
3
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
4
|
-
|
5
|
-
require 'rspec/rails'
|
6
|
-
require 'capybara/rspec'
|
7
|
-
require 'factory_girl_rails'
|
8
|
-
require 'config_helper'
|
9
|
-
|
10
|
-
Rails.backtrace_cleaner.remove_silencers!
|
11
|
-
|
12
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
13
|
-
# in spec/support/ and its subdirectories.
|
14
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
15
|
-
|
16
|
-
RSpec.configure do |config|
|
17
|
-
config.mock_with :rspec
|
18
|
-
config.use_transactional_fixtures = true
|
19
|
-
config.infer_base_class_for_anonymous_controllers = false
|
20
|
-
config.order = "random"
|
21
|
-
end
|