From e1d708dc1f44f2ac59b7d025ee8ba1b8622a101a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 10 Sep 2015 11:03:59 +0200 Subject: [PATCH] adds specs for tracking level 2 users --- spec/features/stats_spec.rb | 21 +++++++++++++++++++++ spec/support/common_actions.rb | 13 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 spec/features/stats_spec.rb diff --git a/spec/features/stats_spec.rb b/spec/features/stats_spec.rb new file mode 100644 index 000000000..33c069e44 --- /dev/null +++ b/spec/features/stats_spec.rb @@ -0,0 +1,21 @@ +require 'rails_helper' + +feature 'Stats' do + + scenario 'Level 2 user', :focus do + admin = create(:administrator) + user = create(:user) + login_as(user) + + visit account_path + click_link 'Verify my account' + verify_residence + confirm_phone + + login_as(admin.user) + visit stats_path + + expect(page).to have_content "Level 2 User (1)" + end + +end \ No newline at end of file diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 4753abbbb..c1d382b4e 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -110,4 +110,17 @@ module CommonActions click_button 'Verify residence' expect(page).to have_content 'Residence verified' end + + def confirm_phone + fill_in 'sms_phone', with: "611111111" + click_button 'Send' + + expect(page).to have_content 'Security code confirmation' + + user = User.last.reload + fill_in 'sms_confirmation_code', with: user.sms_confirmation_code + click_button 'Send' + + expect(page).to have_content 'Correct code' + end end