diff options
| author | jpl | 2016-08-23 11:28:06 +0200 | 
|---|---|---|
| committer | jpl | 2016-08-23 11:28:06 +0200 | 
| commit | 8b3f3055ec5ee19bdaf9f334c83cfcdd01c7ed0b (patch) | |
| tree | 5f542928e52540fd2d7bead72644e11186a9f3ca /features/step_definitions | |
| parent | cdd593a7faddbcf61ca71eb57421478623aed897 (diff) | |
| download | chouette-core-8b3f3055ec5ee19bdaf9f334c83cfcdd01c7ed0b.tar.bz2 | |
Refs #1482: adding cucumber for tests
Diffstat (limited to 'features/step_definitions')
| -rw-r--r-- | features/step_definitions/.gitkeep | 0 | ||||
| -rw-r--r-- | features/step_definitions/authentification_steps.rb | 0 | ||||
| -rw-r--r-- | features/step_definitions/general_steps.rb | 10 | ||||
| -rw-r--r-- | features/step_definitions/users_steps.rb | 16 | 
4 files changed, 26 insertions, 0 deletions
| diff --git a/features/step_definitions/.gitkeep b/features/step_definitions/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/features/step_definitions/.gitkeep diff --git a/features/step_definitions/authentification_steps.rb b/features/step_definitions/authentification_steps.rb new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/features/step_definitions/authentification_steps.rb diff --git a/features/step_definitions/general_steps.rb b/features/step_definitions/general_steps.rb new file mode 100644 index 000000000..cb3a6a69c --- /dev/null +++ b/features/step_definitions/general_steps.rb @@ -0,0 +1,10 @@ +# language: fr + +##### Alors ##### +Alors(/^je ne dois pas pouvoir visiter la page (.+)$/) do |name| +  case name +    when "d'accueil" +      visit root_path +  end +  expect(page.status_code).to eq(403) +end
\ No newline at end of file diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb new file mode 100644 index 000000000..b84ec1fa5 --- /dev/null +++ b/features/step_definitions/users_steps.rb @@ -0,0 +1,16 @@ +# language: fr + +##### Utility methods ##### +def create_user email, password, username +  Fabricate.build(:user, email: email, username: username, password: password).save +end + +##### Etant donné ##### +Etantdonné(/^un compte confirmé pour "([^\"]+)"(?: avec un nom d'utilisateur "(.+)")?$/) do |email, username| +  username ||= email.split("@").first +  create_user email, 'password', username +end + +Etantdonnéque(/^je suis déconnecté$/) do +  # visit destroy_user_session_path +end
\ No newline at end of file | 
