Skip to content

Commit

Permalink
Added feature tests na Feedback Bar (100% coverage) (#375)
Browse files Browse the repository at this point in the history
Added feature tests na Feedback Bar, closes #162 

Co-authored-by: Jan Macek <[email protected]>
Co-authored-by: Jano Suchal <[email protected]>
  • Loading branch information
3 people authored Sep 19, 2020
1 parent 3af1708 commit 4d68f4c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/features/feedbacks_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'rails_helper'

RSpec.feature 'Feedback Bar', type: :feature, js: true do

scenario 'User opens feedback bar' do
visit root_path
find('#ga-feedback-bug-report').click

expect(page.body).to have_text('Nahlásenie chyby')
end

scenario 'User submits feedback' do
visit root_path
find('#ga-feedback-bug-report').click
fill_in 'bug_what_were_you_doing', with: 'Testing feedback bar'
fill_in 'bug_what_went_wrong', with: 'Testing of feedback bar'
expect_any_instance_of(Recaptcha::Adapters::ControllerMethods).to receive(:verify_recaptcha).and_return(true)
click_button 'Odoslať'

expect(page).to have_text('Váš podnet bol odoslaný. Ďakujeme.')
end

scenario 'User submits feedback and Recaptcha is requested' do
visit root_path
find('#ga-feedback-bug-report').click
fill_in 'bug_what_were_you_doing', with: 'Testing feedback bar'
fill_in 'bug_what_went_wrong', with: 'Testing of feedback bar'
expect_any_instance_of(Recaptcha::Adapters::ControllerMethods).to receive(:verify_recaptcha).and_return(false)
click_button 'Odoslať'

expect(page).to have_text('Prosím, potvrďte, že nie ste robot.')
end
end

0 comments on commit 4d68f4c

Please sign in to comment.