aboutsummaryrefslogtreecommitdiffstats
path: root/features/step_definitions
diff options
context:
space:
mode:
authorjpl2016-08-23 11:28:06 +0200
committerjpl2016-08-23 11:28:06 +0200
commit8b3f3055ec5ee19bdaf9f334c83cfcdd01c7ed0b (patch)
tree5f542928e52540fd2d7bead72644e11186a9f3ca /features/step_definitions
parentcdd593a7faddbcf61ca71eb57421478623aed897 (diff)
downloadchouette-core-8b3f3055ec5ee19bdaf9f334c83cfcdd01c7ed0b.tar.bz2
Refs #1482: adding cucumber for tests
Diffstat (limited to 'features/step_definitions')
-rw-r--r--features/step_definitions/.gitkeep0
-rw-r--r--features/step_definitions/authentification_steps.rb0
-rw-r--r--features/step_definitions/general_steps.rb10
-rw-r--r--features/step_definitions/users_steps.rb16
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