crusade_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +48 -0
- data/app/assets/javascripts/crusade.js +15 -0
- data/app/assets/javascripts/crusade_rails/configuration.js.coffee.erb +4 -0
- data/app/assets/javascripts/crusade_rails/crusade.js.coffee +46 -0
- data/app/assets/javascripts/crusade_rails/notification_permission.js.coffee +13 -0
- data/app/assets/stylesheets/crusade_rails/application.css +13 -0
- data/app/controllers/crusade_rails/apns/v1/log_controller.rb +13 -0
- data/app/controllers/crusade_rails/apns/v1/push_package_controller.rb +23 -0
- data/app/controllers/crusade_rails/apns/v1/subscription_controller.rb +37 -0
- data/app/controllers/crusade_rails/application_controller.rb +14 -0
- data/app/helpers/crusade_rails/application_helper.rb +4 -0
- data/app/models/crusade_rails/user_subscription.rb +4 -0
- data/app/services/crusade_rails/notification_service.rb +36 -0
- data/app/services/crusade_rails/user_subscription_service.rb +36 -0
- data/app/views/layouts/crusade_rails/application.html.erb +14 -0
- data/config/initializers/teaspoon.rb +65 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20130917203302_create_crusade_rails_user_subscriptions.rb +12 -0
- data/lib/crusade_rails/configuration_loader.rb +33 -0
- data/lib/crusade_rails/engine.rb +9 -0
- data/lib/crusade_rails/version.rb +3 -0
- data/lib/crusade_rails.rb +4 -0
- data/lib/generators/crusade/install/USAGE +9 -0
- data/lib/generators/crusade/install/install_generator.rb +17 -0
- data/lib/generators/crusade/install/templates/configuration.yml +23 -0
- data/lib/generators/crusade/install/templates/initializer.rb +2 -0
- data/lib/tasks/crusade_rails_tasks.rake +4 -0
- data/test/controllers/apns/v1/log_controller_test.rb +35 -0
- data/test/controllers/apns/v1/push_package_controller_test.rb +41 -0
- data/test/controllers/apns/v1/subscription_controller_test.rb +61 -0
- data/test/crusade_rails_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/certificate.p12 +0 -0
- data/test/dummy/config/crusade.yml +23 -0
- data/test/dummy/config/crusade_absolute.yml +13 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/crusade.rb +2 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130921092524_create_crusade_rails_user_subscriptions.crusade_rails.rb +13 -0
- data/test/dummy/db/schema.rb +34 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/lib/icon.iconset/icon_128x128.png +0 -0
- data/test/dummy/lib/icon.iconset/icon_128x128@2x.png +0 -0
- data/test/dummy/lib/icon.iconset/icon_16x16.png +0 -0
- data/test/dummy/lib/icon.iconset/icon_16x16@2x.png +0 -0
- data/test/dummy/lib/icon.iconset/icon_32x32.png +0 -0
- data/test/dummy/lib/icon.iconset/icon_32x32@2x.png +0 -0
- data/test/dummy/log/development.log +9000 -0
- data/test/dummy/log/test.log +18388 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0330051201f83b2ff3843e3c6747e79d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0534641409a2140bc6e7ebc3ffb3a54d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/108a4cc5d6041a541455f23f064f718f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/10b6d318fbf01394655188cb55968932 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1903ce46cdbce5cbddb3f58cacb00c89 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/19e13c514bd0c76f667eacd20d91d72c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1d295354fabfd91032e5c51cf32fe192 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/24efeb1e9e576159a181fb53b3f114a7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/27cb4afd1625534b2a374a81b9df26de +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/28fcfef8d3cf8654ba549bc1761e83e4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2969a922d5c2342a65712f8bd9cc99a6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2de3b3bd851fd121492b6d4ac403e556 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2e0be385ec13186af8c1ea31b03b96fd +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2e465486b1a6c8f2d49a4ed114d70396 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3125a19a8cea48c16b56e8b59a5c5294 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3cc705332293b3c69203db8a96e9d830 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3cd8491f62d0bb72dc92a13205463599 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3cde555d17b62d65401cc9272bae6e08 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/556f3a4cc7bf634157a1bcb26a3d2b6d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5f268780e6c88d505c5593761755010a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6701d9e3411fdcd8e5e547bdec87cb66 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6b77a9aa8954a56d3da421ee8f0813e8 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6f19bfcf39fc6e2ba42b315015e41741 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/72194bfe82d488c5e022c9046c0581c5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/732aa0a732c68b36c462c1aa61e9c5db +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/742719bcba2beaa6ee593b3c6eabe40b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/753c20567a3407e94309e3a586ba70c1 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/76d2c2ca1f8747e7c285677d59d1f9d9 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8674169919e38981b419dbd475a583aa +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8770d1f7ac46ca50bf453462671ea0b9 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8b4c20d1cbaeadc08407a48823e8c7c3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8d66da576394374d14318805fe809466 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9aacc018015dba444d327301c20b63c5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9bf8f0dcacf365b365a44fc7acaf5b33 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9f6a5c70035131b2862f0cf1b1ffba5f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/aa3a6aa3669f27355e35fd070b5ec5cc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b0f0a9774bdd9aba74bc3dbaa280abd2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b116102c65d66d0bac493130339e906f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b3c46efa2d626eb47c04b3299485ada2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b60162f01dfafeaa2fd08552bee0d7b7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ba4082b2576e0439500c1de73f75e722 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bd98cfe5b883a49d02e51dff15eb2d62 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d0ba95da0d65927f38a86ec70536acfa +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ddcd3a7d9f01da29b22f5bb8894c9e9d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/dfb8f1f4a35d49c4853bb839dd074b03 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/edb1e911142e4ffa330d5f54129ae937 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f3676986bcff0feb06ca29fc36c62054 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f8e371443421803a78fdbe7fb29531b7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f9b223cb5385faca472d99ad42c60776 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/fcd414d106937117c1f77dafcb48d32d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ff6fd5ae68516118b84d0dc0485e4456 +0 -0
- data/test/fixtures/crusade_rails/default_routes.rb +6 -0
- data/test/generators/install_generator_test.rb +66 -0
- data/test/integration/configuration_loader_test.rb +56 -0
- data/test/integration/push_package_integration_test.rb +14 -0
- data/test/javascripts/support/jquery.js +9790 -0
- data/test/javascripts/support/safari.coffee +7 -0
- data/test/javascripts/test_helper.coffee +25 -0
- data/test/javascripts/unit/configuration_test.js.coffee +11 -0
- data/test/javascripts/unit/crusade_test.js.coffee +102 -0
- data/test/javascripts/unit/notification_permission_test.js.coffee +49 -0
- data/test/routes/apns_routes_test.rb +39 -0
- data/test/services/notification_service_test.rb +69 -0
- data/test/services/user_subscription_service_test.rb +104 -0
- data/test/support/fake_push_notification.rb +24 -0
- data/test/teaspoon_env.rb +33 -0
- data/test/test_helper.rb +27 -0
- metadata +468 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/404.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'generators/crusade/install/install_generator'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'tmpdir'
|
6
|
+
|
7
|
+
describe Crusade::InstallGenerator do
|
8
|
+
let(:destination_dir) { Dir.mktmpdir }
|
9
|
+
|
10
|
+
after { FileUtils.remove_entry_secure destination_dir}
|
11
|
+
|
12
|
+
before do
|
13
|
+
$stdout.stubs(:puts)
|
14
|
+
generator.destination_root = destination_dir
|
15
|
+
FileUtils.mkdir_p File.join destination_dir, 'config', 'initializers'
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:generator) { Crusade::InstallGenerator.new }
|
19
|
+
let(:content) { File.read file }
|
20
|
+
|
21
|
+
describe 'create_initializer_file' do
|
22
|
+
let(:file) { File.join destination_dir, 'config','initializers', 'crusade.rb' }
|
23
|
+
|
24
|
+
before { generator.copy_initializer_file }
|
25
|
+
|
26
|
+
it 'generate a crusade file' do
|
27
|
+
File.exists?(file).must_be_true
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'loads the configuration' do
|
31
|
+
found = content =~ /CrusadeRails.load_configuration!/
|
32
|
+
|
33
|
+
found.wont_be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'create_initializer_file' do
|
38
|
+
let(:file) { File.join destination_dir, 'config', 'crusade.yml' }
|
39
|
+
|
40
|
+
before { generator.copy_configuration_file }
|
41
|
+
|
42
|
+
it 'generates a crusade file' do
|
43
|
+
File.exists?(file).must_be_true
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'loads the configuration' do
|
47
|
+
content.must_equal File.read 'lib/generators/crusade/install/templates/configuration.yml'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'modify routes' do
|
52
|
+
let(:file) { File.join destination_dir, 'config', 'routes.rb' }
|
53
|
+
|
54
|
+
before do
|
55
|
+
FileUtils.cp 'test/fixtures/crusade_rails/default_routes.rb', file
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'updates the routes file' do
|
59
|
+
generator.update_routes
|
60
|
+
|
61
|
+
found = content =~ /mount CrusadeRails::Engine, at: "\/push"/
|
62
|
+
|
63
|
+
found.wont_be_nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe CrusadeRails do
|
4
|
+
|
5
|
+
describe 'initializer' do
|
6
|
+
it 'loads the configuration' do
|
7
|
+
Rails.application.config.crusade.wont_be_nil
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'load_configuration' do
|
12
|
+
let(:configuration) { CrusadeRails::load_configuration! }
|
13
|
+
|
14
|
+
it 'loads the configuration in the config directory' do
|
15
|
+
configuration.webservice_url.must_equal 'https://www.example.com/push'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'sets the config into the rails application configuration' do
|
19
|
+
config = Rails.application.config.crusade
|
20
|
+
|
21
|
+
config.webservice_url.must_equal 'https://www.example.com/push'
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'relative paths' do
|
25
|
+
it 'prefixes the iconset.dir by the Rails.root' do
|
26
|
+
configuration.iconset_dir.must_equal File.join Rails.root, 'lib/icon.iconset'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'prefixes the certificate by the Rails.root' do
|
30
|
+
configuration.certificate.must_equal File.join Rails.root, 'config/certificate.p12'
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'absolute paths' do
|
36
|
+
let(:absolute_file) { "#{Rails.root}/config/crusade_absolute.yml" }
|
37
|
+
let(:configuration) { CrusadeRails::load_configuration! absolute_file }
|
38
|
+
|
39
|
+
it 'keeps the iconset.dir' do
|
40
|
+
configuration.iconset_dir.must_equal '/tmp/lib/icon.iconset'
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'keeps the certificate' do
|
44
|
+
configuration.certificate.must_equal '/tmp/config/certificate.p12'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'does not memoizes the configuration' do
|
49
|
+
config = Rails.application.config.crusade
|
50
|
+
|
51
|
+
CrusadeRails::load_configuration!
|
52
|
+
|
53
|
+
config.wont_be_same_as Rails.application.config.crusade
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe 'Push Package Integration Test' do
|
4
|
+
let(:user_id) { 1234 }
|
5
|
+
|
6
|
+
it 'generates and send the push package' do
|
7
|
+
post '/push/apns/v1/pushPackages/web.com.example.push.id', {},
|
8
|
+
'RAW_POST_DATA' => "{\"user\": \"#{user_id}\"}"
|
9
|
+
|
10
|
+
response.status.must_equal 200
|
11
|
+
response.content_type.must_equal 'application/zip'
|
12
|
+
response.content_length.must_be_close_to 21217, 10
|
13
|
+
end
|
14
|
+
end
|