rails_twirp 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.standard.yml +0 -1
  3. data/CHANGELOG.md +4 -0
  4. data/lib/rails_twirp/version.rb +1 -1
  5. data/rails_twirp.gemspec +2 -2
  6. metadata +8 -78
  7. data/.github/workflows/test.yml +0 -21
  8. data/bin/test +0 -5
  9. data/lib/rails_twirp/testing/integration_test.rb +0 -106
  10. data/test/dummy/Rakefile +0 -6
  11. data/test/dummy/app/assets/config/manifest.js +0 -2
  12. data/test/dummy/app/assets/images/.keep +0 -0
  13. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  14. data/test/dummy/app/channels/application_cable/channel.rb +0 -4
  15. data/test/dummy/app/channels/application_cable/connection.rb +0 -4
  16. data/test/dummy/app/controllers/application_controller.rb +0 -2
  17. data/test/dummy/app/controllers/application_twirp_controller.rb +0 -7
  18. data/test/dummy/app/controllers/concerns/.keep +0 -0
  19. data/test/dummy/app/controllers/dummy_controller.rb +0 -5
  20. data/test/dummy/app/controllers/pings_controller.rb +0 -40
  21. data/test/dummy/app/controllers/testmod/nested/other_controller.rb +0 -10
  22. data/test/dummy/app/helpers/application_helper.rb +0 -2
  23. data/test/dummy/app/helpers/random_helper.rb +0 -5
  24. data/test/dummy/app/javascript/packs/application.js +0 -15
  25. data/test/dummy/app/jobs/application_job.rb +0 -7
  26. data/test/dummy/app/mailers/application_mailer.rb +0 -4
  27. data/test/dummy/app/models/application_record.rb +0 -3
  28. data/test/dummy/app/models/concerns/.keep +0 -0
  29. data/test/dummy/app/views/dummy/rpc_name_check.pb.pbbuilder +0 -3
  30. data/test/dummy/app/views/layouts/application.html.erb +0 -15
  31. data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
  32. data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
  33. data/test/dummy/app/views/pings/ping_template.pb.pbbuilder +0 -1
  34. data/test/dummy/bin/generate +0 -3
  35. data/test/dummy/bin/rails +0 -4
  36. data/test/dummy/bin/rake +0 -4
  37. data/test/dummy/bin/setup +0 -33
  38. data/test/dummy/config/application.rb +0 -23
  39. data/test/dummy/config/boot.rb +0 -5
  40. data/test/dummy/config/cable.yml +0 -10
  41. data/test/dummy/config/database.yml +0 -25
  42. data/test/dummy/config/environment.rb +0 -5
  43. data/test/dummy/config/environments/development.rb +0 -76
  44. data/test/dummy/config/environments/production.rb +0 -120
  45. data/test/dummy/config/environments/test.rb +0 -59
  46. data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
  47. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
  48. data/test/dummy/config/initializers/content_security_policy.rb +0 -28
  49. data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
  50. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -6
  51. data/test/dummy/config/initializers/inflections.rb +0 -16
  52. data/test/dummy/config/initializers/mime_types.rb +0 -4
  53. data/test/dummy/config/initializers/permissions_policy.rb +0 -11
  54. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  55. data/test/dummy/config/locales/en.yml +0 -33
  56. data/test/dummy/config/puma.rb +0 -43
  57. data/test/dummy/config/routes.rb +0 -3
  58. data/test/dummy/config/storage.yml +0 -34
  59. data/test/dummy/config/twirp/routes.rb +0 -22
  60. data/test/dummy/config.ru +0 -6
  61. data/test/dummy/lib/assets/.keep +0 -0
  62. data/test/dummy/log/.keep +0 -0
  63. data/test/dummy/proto/api.proto +0 -30
  64. data/test/dummy/proto/api_pb.rb +0 -29
  65. data/test/dummy/proto/api_twirp.rb +0 -25
  66. data/test/dummy/public/404.html +0 -67
  67. data/test/dummy/public/422.html +0 -67
  68. data/test/dummy/public/500.html +0 -66
  69. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  70. data/test/dummy/public/apple-touch-icon.png +0 -0
  71. data/test/dummy/public/favicon.ico +0 -0
  72. data/test/dummy_test.rb +0 -10
  73. data/test/other_controller_test.rb +0 -9
  74. data/test/ping_controller_test.rb +0 -114
  75. data/test/rails_twirp_test.rb +0 -7
  76. data/test/test_helper.rb +0 -16
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- .rails-default-error-page {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- .rails-default-error-page div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- .rails-default-error-page div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- .rails-default-error-page h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- .rails-default-error-page div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body class="rails-default-error-page">
58
- <!-- This file lives in public/404.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The page you were looking for doesn't exist.</h1>
62
- <p>You may have mistyped the address or the page may have moved.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- .rails-default-error-page {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- .rails-default-error-page div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- .rails-default-error-page div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- .rails-default-error-page h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- .rails-default-error-page div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body class="rails-default-error-page">
58
- <!-- This file lives in public/422.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The change you wanted was rejected.</h1>
62
- <p>Maybe you tried to change something you didn't have access to.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- .rails-default-error-page {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- .rails-default-error-page div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- .rails-default-error-page div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- .rails-default-error-page h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- .rails-default-error-page div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body class="rails-default-error-page">
58
- <!-- This file lives in public/500.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>We're sorry, but something went wrong.</h1>
62
- </div>
63
- <p>If you are the application owner check the logs for more information.</p>
64
- </div>
65
- </body>
66
- </html>
File without changes
File without changes
File without changes
data/test/dummy_test.rb DELETED
@@ -1,10 +0,0 @@
1
- require "test_helper"
2
-
3
- class DummyControllerTest < RailsTwirp::IntegrationTest
4
- test "controller gets rpc name" do
5
- req = RPC::DummyAPI::RpcNameCheckRequest.new
6
- rpc RPC::DummyAPI::DummyService, "RpcNameCheck", req
7
- assert_instance_of RPC::DummyAPI::RpcNameCheckResponse, response
8
- assert_equal "RpcNameCheck", response.rpc_name
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- require "test_helper"
2
-
3
- class OtherControllerTest < RailsTwirp::IntegrationTest
4
- test "modules work" do
5
- req = RPC::DummyAPI::PingRequest.new(name: "Bouke")
6
- rpc RPC::DummyAPI::DummyService, "Nested", req
7
- assert_equal "BoukeBouke", response.double_name
8
- end
9
- end
@@ -1,114 +0,0 @@
1
- require "test_helper"
2
-
3
- class PingControllerTest < RailsTwirp::IntegrationTest
4
- test "you can ping it" do
5
- req = RPC::DummyAPI::PingRequest.new(name: "Bouke")
6
- rpc RPC::DummyAPI::DummyService, "Ping", req
7
- assert_equal "BoukeBouke", response.double_name
8
- end
9
-
10
- test "you can ping render" do
11
- req = RPC::DummyAPI::PingRequest.new(name: "Bouke")
12
- rpc RPC::DummyAPI::DummyService, "PingRender", req
13
- refute_instance_of Twirp::Error, response
14
- assert_equal "http://www.example.com/twirp BoukeBouke", response.double_name
15
- end
16
-
17
- test "you can ping render with host and https" do
18
- host! "localhost"
19
- https!
20
- req = RPC::DummyAPI::PingRequest.new(name: "Bouke")
21
- rpc RPC::DummyAPI::DummyService, "PingRender", req
22
- refute_instance_of Twirp::Error, response
23
- assert_equal "https://localhost/twirp BoukeBouke", response.double_name
24
- end
25
-
26
- test "you can ping template" do
27
- req = RPC::DummyAPI::PingRequest.new(name: "Bouke")
28
- rpc RPC::DummyAPI::DummyService, "PingTemplate", req
29
- refute_instance_of Twirp::Error, response
30
- assert_equal "BoukeBouke", response.double_name
31
- end
32
-
33
- test "error response" do
34
- req = RPC::DummyAPI::PingRequest.new
35
- rpc RPC::DummyAPI::DummyService, "ErrorResponse", req
36
- assert_instance_of Twirp::Error, response
37
- assert_equal "You are not authenticated!!", response.msg
38
- assert_equal :unauthenticated, response.code
39
- end
40
-
41
- test "raise error" do
42
- req = RPC::DummyAPI::PingRequest.new
43
- rpc RPC::DummyAPI::DummyService, "RaiseError", req
44
- assert_instance_of Twirp::Error, response
45
- assert_equal "Not found", response.msg
46
- assert_equal :not_found, response.code
47
- end
48
-
49
- test "uncaught errors should bubble up to the test" do
50
- req = RPC::DummyAPI::PingRequest.new
51
- assert_raises StandardError, "Uncaught" do
52
- rpc RPC::DummyAPI::DummyService, "UncaughtError", req
53
- end
54
- end
55
-
56
- test "uncaught errors should return an internal error with details if show_exceptions is true" do
57
- Rails.application.env_config["action_dispatch.show_exceptions"] = true
58
-
59
- req = RPC::DummyAPI::PingRequest.new
60
- rpc RPC::DummyAPI::DummyService, "UncaughtError", req
61
- assert_instance_of Twirp::Error, response
62
- assert_equal :internal, response.code
63
- assert_equal "Uncaught", response.msg
64
- assert_equal "StandardError", response.meta["cause"]
65
- ensure
66
- Rails.application.env_config["action_dispatch.show_exceptions"] = false
67
- end
68
-
69
- test "uncaught errors should be fanned out to the exception handler proc if one is defined" do
70
- Rails.application.env_config["action_dispatch.show_exceptions"] = true
71
-
72
- captured_exception = nil
73
- RailsTwirp.unhandled_exception_handler = ->(e) { captured_exception = e }
74
-
75
- req = RPC::DummyAPI::PingRequest.new
76
- rpc RPC::DummyAPI::DummyService, "UncaughtError", req
77
- assert_instance_of Twirp::Error, response
78
- assert_equal :internal, response.code
79
- assert_equal "Uncaught", response.msg
80
- assert_equal "StandardError", response.meta["cause"]
81
- assert_kind_of StandardError, captured_exception
82
- ensure
83
- RailsTwirp.unhandled_exception_handler = nil
84
- Rails.application.env_config["action_dispatch.show_exceptions"] = false
85
- end
86
-
87
- test "uncaught errors should return an internal error without if show_exceptions is true and show_detailed_exceptions is false" do
88
- Rails.application.env_config["action_dispatch.show_exceptions"] = true
89
- Rails.application.env_config["action_dispatch.show_detailed_exceptions"] = false
90
-
91
- req = RPC::DummyAPI::PingRequest.new
92
- rpc RPC::DummyAPI::DummyService, "UncaughtError", req
93
- assert_instance_of Twirp::Error, response
94
- assert_equal :internal, response.code
95
- assert_equal "Internal error", response.msg
96
- ensure
97
- Rails.application.env_config["action_dispatch.show_detailed_exceptions"] = true
98
- Rails.application.env_config["action_dispatch.show_exceptions"] = false
99
- end
100
-
101
- test "before error" do
102
- req = RPC::DummyAPI::PingRequest.new
103
- rpc RPC::DummyAPI::DummyService, "BeforeError", req
104
- assert_instance_of Twirp::Error, response
105
- assert_equal "yOuR ReQuEsT Is mAlFoRmEd", response.msg
106
- assert_equal :malformed, response.code
107
- end
108
-
109
- test "controller is set to the controller that handled the request" do
110
- req = RPC::DummyAPI::PingRequest.new(name: "Bouke")
111
- rpc RPC::DummyAPI::DummyService, "Ping", req
112
- assert_instance_of PingsController, controller
113
- end
114
- end
@@ -1,7 +0,0 @@
1
- require "test_helper"
2
-
3
- class RailsTwirpTest < ActiveSupport::TestCase
4
- test "it has a version number" do
5
- assert RailsTwirp::VERSION
6
- end
7
- end
data/test/test_helper.rb DELETED
@@ -1,16 +0,0 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- require_relative "../test/dummy/config/environment"
5
- ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
6
- require "rails/test_help"
7
- require "rails/test_unit/reporter"
8
- Rails::TestUnitReporter.executable = "bin/test"
9
-
10
- # Load fixtures from the engine
11
- if ActiveSupport::TestCase.respond_to?(:fixture_path=)
12
- ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__)
13
- ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
14
- ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files"
15
- ActiveSupport::TestCase.fixtures :all
16
- end