diff --git a/app/views/membership_apps/show.html.erb b/app/views/membership_apps/show.html.erb
index 6a23f55..f5965c6 100644
--- a/app/views/membership_apps/show.html.erb
+++ b/app/views/membership_apps/show.html.erb
@@ -1,5 +1,10 @@
-
<%= translate '.header' %>
-
<%= translate '.lead_text' %>
-
+ <% if @membership_app.person %>
+
<%= translate '.congratulations' %>
+
<%= translate '.lead_congratulations' %>
+ <% else %>
+
<%= translate '.header' %>
+
<%= translate '.lead_text' %>
+
+ <% end %>
diff --git a/config/locales/views/ru.yml b/config/locales/views/ru.yml
index b108c1d..9de1444 100644
--- a/config/locales/views/ru.yml
+++ b/config/locales/views/ru.yml
@@ -9,6 +9,9 @@ ru:
личности.
membership_apps:
show:
+ congratulations: Поздравляем!
+ lead_congratulations: >
+ Вы уже являетесь членом или сторонником Либертарианской партии России!
header: Ваше заявление в обработке
lead_text: >
На данной странице вы можете отслеживать статус вашего заявления.
diff --git a/features/desktop/membership_app.feature b/features/desktop/membership_app.feature
index b17cb75..7c3f2ca 100644
--- a/features/desktop/membership_app.feature
+++ b/features/desktop/membership_app.feature
@@ -1,5 +1,5 @@
Feature: Membership application
- Scenario:
+ Scenario: as a visitor
When I visit the main page
And I click the button "Вступить"
And I fill form with the following data:
@@ -15,3 +15,9 @@ Feature: Membership application
| Комментарий | Примите, плиз |
And I click the form button "Отправить заявление"
Then I see the membership application tracking page
+
+ Scenario: as a member
+ Given I am signed in as party member
+ When I visit the main page
+ And I click the button "Ваше заявление"
+ Then I see that I am already a party member
diff --git a/features/step_definitions/membership_application.rb b/features/step_definitions/membership_application.rb
index 6525ba6..29c06c4 100644
--- a/features/step_definitions/membership_application.rb
+++ b/features/step_definitions/membership_application.rb
@@ -11,6 +11,23 @@ end
Then 'I see the membership application tracking page' do
expect(page.current_path).to eq '/application'
expect(page).to have_css 'h1', text: 'Ваше заявление в обработке'
+ expect(page).to have_css(
+ 'p.lead',
+ text: <<~TEXT.split("\n").join(' '),
+ На данной странице вы можете отслеживать статус вашего заявления.
+ Сохраните её в закладки браузера. Также на указанный вами адрес
+ электронной почты была отправлена ссылка на данную страницу.
+ В ближайшее время с вами свяжутся по указанным вами контактам.
+ TEXT
+ )
+end
+
+Then 'I see that I am already a party member' do
+ expect(page.current_path).to eq '/application'
+ expect(page).to have_css 'h1', text: 'Поздравляем!'
+ expect(page).to have_css 'p.lead',
+ text: 'Вы уже являетесь членом или сторонником ' \
+ 'Либертарианской партии России!'
end
When 'I send a membership application' do
diff --git a/features/step_definitions/user.rb b/features/step_definitions/user.rb
index a2ebaea..b2cf728 100644
--- a/features/step_definitions/user.rb
+++ b/features/step_definitions/user.rb
@@ -40,6 +40,24 @@ Given 'I am signed in with email {string} ' \
expect(page).to have_css 'ul > li > a', text: @user.email
end
+Given 'I am signed in as party member' do
+ @person = create :person
+ @account = create :usual_account, person: @person
+ create :membership_app, account: @account
+ @user = @account.user
+
+ visit '/users/sign_in'
+
+ within 'form' do
+ fill_in 'Email', with: @user.email
+ fill_in 'Пароль', with: @user.password
+
+ click_on 'Войти'
+ end
+
+ expect(page).to have_css 'ul > li > a', text: @user.email
+end
+
When 'I try to sign in with email {string} ' \
'and password {string}' do |email, password|
visit '/users/sign_in'