Skip to content

Commit 2246749

Browse files
committed
WIP
1 parent 08ba1ea commit 2246749

35 files changed

+473
-875
lines changed

sentry-rails/spec/dummy/test_rails_app/app.rb

Lines changed: 0 additions & 124 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# frozen_string_literal: true
2+
3+
class HelloController < ActionController::Base
4+
def exception
5+
raise "An unhandled exception!"
6+
end
7+
8+
def reporting
9+
render plain: Sentry.last_event_id
10+
end
11+
12+
def view_exception
13+
render inline: "<%= foo %>"
14+
end
15+
16+
def view
17+
render template: "test_template"
18+
end
19+
20+
def world
21+
render plain: "Hello World!"
22+
end
23+
24+
def with_custom_instrumentation
25+
custom_event = "custom.instrument"
26+
ActiveSupport::Notifications.subscribe(custom_event) do |*args|
27+
data = args[-1]
28+
data += 1
29+
end
30+
31+
ActiveSupport::Notifications.instrument(custom_event, 1)
32+
33+
head :ok
34+
end
35+
36+
def not_found
37+
raise ActionController::BadRequest
38+
end
39+
end
40+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# frozen_string_literal: true
2+
3+
class PostsController < ActionController::Base
4+
def index
5+
Post.all.to_a
6+
raise "foo"
7+
end
8+
9+
def show
10+
p = Post.find(params[:id])
11+
12+
render plain: p.id
13+
end
14+
15+
def attach
16+
p = Post.find(params[:id])
17+
18+
attach_params = {
19+
io: File.open(File.join(Rails.root, 'public', 'sentry-logo.png')),
20+
filename: 'sentry-logo.png'
21+
}
22+
23+
# service_name parameter was added in Rails 6.1
24+
if Rails.gem_version >= Gem::Version.new('6.1.0')
25+
attach_params[:service_name] = "test"
26+
end
27+
28+
p.cover.attach(attach_params)
29+
30+
render plain: p.id
31+
end
32+
end
33+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
class Comment < ActiveRecord::Base
4+
belongs_to :post
5+
end
6+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class Post < ActiveRecord::Base
4+
has_many :comments
5+
has_one_attached :cover
6+
end
7+

sentry-rails/spec/dummy/test_rails_app/apps/5-2.rb

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)