From 21ef3f631c433600e0b23e0a9236e89664b12610 Mon Sep 17 00:00:00 2001 From: mathiasVoelcker Date: Wed, 9 Nov 2016 11:08:35 -0200 Subject: [PATCH] =?UTF-8?q?#3=20<@mathiasVoelcker,=20@cristianferreira>=20?= =?UTF-8?q?-=20testar=20inser=C3=A7=C3=A3o=20de=20dados=20invalidos=20em?= =?UTF-8?q?=20input=20de=20solicitar=20doacao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demand_blood_banks_controller.rb | 1 + coverage/.last_run.json | 2 +- coverage/.resultset.json | 30 +++++++++++++++---- spec/features/demand_blood_spec.rb | 17 +++++++++++ 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/app/controllers/demand_blood_banks_controller.rb b/app/controllers/demand_blood_banks_controller.rb index 884f79f..0ac24b4 100644 --- a/app/controllers/demand_blood_banks_controller.rb +++ b/app/controllers/demand_blood_banks_controller.rb @@ -16,6 +16,7 @@ def index # GET /demand_blood_banks/new def new @demand_blood_bank = DemandBloodBank.new + @demand_blood_bank.save @lastUpdateNecessity = DemandBloodBank.last.updated_at.strftime("%d/%m/%Y - %H:%M:%S") end diff --git a/coverage/.last_run.json b/coverage/.last_run.json index 8b9a867..4b1f0a8 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "covered_percent": 70.14 + "covered_percent": 71.52 } } diff --git a/coverage/.resultset.json b/coverage/.resultset.json index dcfa24d..2f69e75 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -49,6 +49,23 @@ 1, null, null, + null, + 1, + 1, + 1, + null, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + null, + 1, + null, + null, null ], "/myapp/spec/rails_helper.rb": [ @@ -86,7 +103,7 @@ 1, null, 1, - 70, + 103, null, null, null, @@ -949,11 +966,11 @@ 1, null, 1, - 6, + 8, null, null, 1, - 6, + 8, null, null, 1, @@ -1167,8 +1184,9 @@ null, null, 1, - 3, - null, + 4, + 4, + 4, null, null, null, @@ -1288,6 +1306,6 @@ null ] }, - "timestamp": 1478696082 + "timestamp": 1478696829 } } diff --git a/spec/features/demand_blood_spec.rb b/spec/features/demand_blood_spec.rb index 20880f9..742de96 100644 --- a/spec/features/demand_blood_spec.rb +++ b/spec/features/demand_blood_spec.rb @@ -45,4 +45,21 @@ expect(page).to have_css(".Button.Button--medium.Button--fluid.is-disabled.js-nextButton") end end + + context "quando inserir dados inválidos" do + it "não deve ativar o botao" do + visit "/necessidadeBanco" + + fill_in "demand_blood_bank_a_positive", with: "e" + page.find('#demand_blood_bank_a_positive').trigger(:focusout) + fill_in "demand_blood_bank_b_positive", with: "!" + page.find('#demand_blood_bank_a_positive').trigger(:focusout) + fill_in "demand_blood_bank_a_negative", with: "&" + page.find('#demand_blood_bank_a_negative').trigger(:focusout) + fill_in "demand_blood_bank_b_negative", with: "+" + page.find('#demand_blood_bank_b_negative').trigger(:focusout) + + expect(page).to have_css(".Button.Button--medium.Button--fluid.is-disabled.js-nextButton") + end + end end