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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea2c03ca235e9769d38e62c4efe859120b3d9e4b
4
- data.tar.gz: 0f9e745ae8e5e4c4edc1776a8fe0d398c0872aa5
3
+ metadata.gz: e5126c39816a9544607fada9211a8afac589e127
4
+ data.tar.gz: bbf908d01246044a51c2bbfa3aba70073cc76d3d
5
5
  SHA512:
6
- metadata.gz: ee7494afc2d75989cf4b65cb1083a795a9ffc1c776ddd38b2548fbefdd35bb1481fc9b6ac34f667b6e34f0ae4b752d62527370a2f7a3682a54d41a9c544eaf17
7
- data.tar.gz: 5365995fd08314a2cb168805ac876c5b21711ffcaf429402d3006eb2db7cd5fe7b2abc3a32e69578bca29670f4bc5f91180cce61afbe1995f180b01bbbd18563
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
- render action: :edit
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]
@@ -6,7 +6,8 @@
6
6
  <div class="ih-span one-quarter">
7
7
  <%= f.input :resource_type,
8
8
  collection: ClarkKent.resource_options,
9
- label: 'A row for every:' %>
9
+ label: 'A row for every:',
10
+ prompt: 'Please Choose' %>
10
11
 
11
12
  </div>
12
13
  <div class="ih-span one-quarter">
@@ -1,3 +1,3 @@
1
1
  module ClarkKent
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
@@ -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
Binary file