From ee288fb0cf8709a33eaa82b0e1ecd8691d2bfb42 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 15 Aug 2019 08:58:02 +0500 Subject: [PATCH] Add features --- factories/people.rb | 8 ++++++++ features/desktop/account.feature | 14 ++++++++++++++ features/step_definitions/account.rb | 15 +++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/factories/people.rb b/factories/people.rb index 30116be..11141d8 100644 --- a/factories/people.rb +++ b/factories/people.rb @@ -39,4 +39,12 @@ FactoryBot.define do regional_office: evaluator.regional_office end end + + factory :federal_manager_person, parent: :initial_person do + after :create do |person, evaluator| + create :federal_manager_relationship, + person: person, + regional_office: evaluator.regional_office + end + end end diff --git a/features/desktop/account.feature b/features/desktop/account.feature index 81c0cfa..e381bbe 100644 --- a/features/desktop/account.feature +++ b/features/desktop/account.feature @@ -61,3 +61,17 @@ Feature: Account And I see text "Hi there :)" And I see text "Исключён из партии" And I see text "Москва" + + Scenario: of a federal manager + Given there is a federal manager account with the following data: + | nickname | kotovalexarian | + | public_name | Alex Kotov | + | biography | Hi there :) | + | federal_subject | Москва | + When I visit "/accounts/kotovalexarian" + Then I see text "kotovalexarian" + And I see text "Alex Kotov" + And I see text "Hi there :)" + And I see text "Член партии" + And I see text "Член ФК" + And I see text "Москва" diff --git a/features/step_definitions/account.rb b/features/step_definitions/account.rb index c42e62a..81e2dfd 100644 --- a/features/step_definitions/account.rb +++ b/features/step_definitions/account.rb @@ -62,3 +62,18 @@ When 'there is an excluded member account with the following data:' do |table| biography: options[:biography], person: person end + +When 'there is a federal manager account with the following data:' do |table| + options = table.raw.map { |(k, v)| [k.to_sym, v] }.to_h + + federal_subject = + create :federal_subject, english_name: options[:federal_subject] + regional_office = create :regional_office, federal_subject: federal_subject + person = create :federal_manager_person, regional_office: regional_office + + create :personal_account, + nickname: options[:nickname], + public_name: options[:public_name], + biography: options[:biography], + person: person +end