diff --git a/features/sign_in.feature b/features/sign_in.feature new file mode 100644 index 0000000..00b9ef34 --- /dev/null +++ b/features/sign_in.feature @@ -0,0 +1,12 @@ +Feature: Sign in + Background: + Given I visit "/users/sign_in" + + Scenario: + When I fill form with the following data: + | key | value | + | Email | user@example.com | + | Пароль | q1w2e3r4t5y6 | + And I click the form button "Войти" + Then I see main page + And I am logged in as "user@example.com" diff --git a/features/step_definitions/stepdefs.rb b/features/step_definitions/stepdefs.rb index 538b6fb..550a339 100644 --- a/features/step_definitions/stepdefs.rb +++ b/features/step_definitions/stepdefs.rb @@ -18,6 +18,10 @@ When 'I click the form button {string}' do |string| end end +Then 'I am logged in as {string}' do |string| + expect(page).to have_css 'span.navbar-text', text: string +end + Then 'I see main page' do expect(page).to have_css( 'h1',