clark_kent 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/clark_kent/reports_controller.rb +5 -1
- data/app/models/clark_kent/report.rb +1 -0
- data/app/views/clark_kent/reports/_edit.html.erb +2 -1
- data/lib/clark_kent/version.rb +1 -1
- data/test/controllers/clark_kent/reports_controller_test.rb +12 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +2613 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5126c39816a9544607fada9211a8afac589e127
|
4
|
+
data.tar.gz: bbf908d01246044a51c2bbfa3aba70073cc76d3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553f89a8085a418d8aa66245e4b782ca613c2327fb52bc7473c28e5354ccd5f2bc27f820e46af7eb62404f97adf0a067bdc8f860ce9eced7d8aa666fac04913f
|
7
|
+
data.tar.gz: 69acda8f042a47ab8dc58d8eed29de78f7c45469ef3c1cc3a007683051442a4383cb70a6a43dbc295b47ba55e2566e9923bcae3bfd8b7493652a495b78f05014
|
@@ -16,7 +16,11 @@ class ClarkKent::ReportsController < ClarkKent::ApplicationController
|
|
16
16
|
def create
|
17
17
|
@report = ClarkKent::Report.new(report_params)
|
18
18
|
@report.save
|
19
|
-
|
19
|
+
if @report.errors.empty?
|
20
|
+
render action: :edit
|
21
|
+
else
|
22
|
+
render action: :new, status: :conflict
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
def show
|
@@ -19,6 +19,7 @@ require 'aws-sdk-v1'
|
|
19
19
|
scope :shared, -> { where(sharing_scope_id: nil) }
|
20
20
|
|
21
21
|
validates :sharing_scope_id, presence: true, if: ->(r) { r.sharing_scope_type.present? }
|
22
|
+
validates :resource_type, presence: {message: 'You must choose a type.'}, allow_blank: false
|
22
23
|
|
23
24
|
def self.send_report_to_s3(report_id, params)
|
24
25
|
report_class = params[:report_class].constantize if params[:report_class]
|
data/lib/clark_kent/version.rb
CHANGED
@@ -32,6 +32,18 @@ class ClarkKent::ReportsControllerTest < ControllerTest
|
|
32
32
|
assert_response :success
|
33
33
|
end
|
34
34
|
|
35
|
+
it "should render errors during creation" do
|
36
|
+
post :create, params:
|
37
|
+
{report: {
|
38
|
+
name: 'delete me', resource_type: '',
|
39
|
+
sharing_scope_id: report.sharing_scope_id, sharing_scope_type: report.sharing_scope_type },
|
40
|
+
current_user_id: current_user.id}
|
41
|
+
report = ClarkKent::Report.find_by(name: 'delete me')
|
42
|
+
report.must_be_nil
|
43
|
+
assert_response :conflict
|
44
|
+
@response.body.must_match 'You must choose a type.'
|
45
|
+
end
|
46
|
+
|
35
47
|
it "should show report" do
|
36
48
|
get :show, params: {id: report, current_user_id: current_user.id}
|
37
49
|
assert_response :success
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|