Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more cucumber tests

  • Loading branch information...
commit 5b5b81ad8cf5e6a6bffdc4fb9b59dab5ecd0bc7f 1 parent 587f9e0
@Stanley authored
View
12 .gitignore
@@ -3,21 +3,9 @@
.DS_Store
*.log
*.pem
-coverage
-nbproject
-config/database.yml
config/couchdb.yml
tmp/.*
tmp/*
doc/*
db/*
.idea/*
-
-vendor/sync/*
-!vendor/sync/DataFactory/
-!vendor/sync/FreshBooks/
-!vendor/sync/PivotalTracker/
-!vendor/sync/Store/
-!vendor/sync/SugarCRM/
-!vendor/sync/SystemApiSamples/
-!vendor/sync/Test/
View
90 features/manage_markers.feature
@@ -0,0 +1,90 @@
+Feature: Manage markers
+ In order to display interesting points on the map
+ a administrator
+ wants to provide new markers and edit them
+
+ Scenario: Access denied
+ Given I am on the new marker page
+ Then I should see "Authentication Required"
+
+ Scenario: Create new marker
+ Given I am logged in as "me@mail.com"
+ And I follow "Dodaj parking"
+ When I fill in "marker_name" with "My name"
+ And I fill in "marker_description" with "My description"
+ And I fill in "marker_lat" with "50.123"
+ And I fill in "marker_lng" with "20.987"
+ And I press "Utwórz"
+ Then I should see "Sukces"
+
+ Scenario: Reject duplicate
+ Given I am logged in as "me@mail.com"
+ And the following markers:
+ | name | description | category | lat | lng |
+ | Moja nazwa | My description | 7 | 50.001 | 20.2 |
+ And I follow "Dodaj parking"
+ When I fill in "marker_name" with "Moja nazwa"
+ And I fill in "marker_description" with "Moj opis"
+ And I fill in "marker_lat" with "50.123"
+ And I fill in "marker_lng" with "20.987"
+ And I press "Utwórz"
+ Then I should see "Punkt o tej nazwie już istnieje"
+
+ Scenario: Edit marker
+ Given I am logged in as "me@mail.com"
+ And the following markers:
+ | name | description | category | lat | lng |
+ | Moja nazwa | My description | 7 | 50.001 | 20.2 |
+ And I am on markers page
+ And I follow "Edytuj Moja nazwa"
+ When I fill in "marker_name" with "Moja nowa nazwa"
+ And I fill in "marker_description" with "Moj nowy opis"
+ And I fill in "marker_lat" with "50.123"
+ And I fill in "marker_lng" with "20.987"
+ And I press "Zmień"
+ Then I should see "Punkt został uaktualniony"
+
+ Scenario: Edit marker, duplicated name
+ Given I am logged in as "me@mail.com"
+ And the following markers:
+ | name | description | category | lat | lng |
+ | Moja nazwa | My description | 7 | 50.001 | 20.2 |
+ | Moja inna nazwa | My descr | 6 | 50.011 | 20.8 |
+ And I am on markers page
+ And I follow "Edytuj Moja nazwa"
+ When I fill in "marker_name" with "Moja inna nazwa"
+ And I fill in "marker_description" with "Moj nowy opis"
+ And I fill in "marker_lat" with "50.123"
+ And I fill in "marker_lng" with "20.987"
+ And I press "Aktualizuj"
+ Then I should see "nazwa już istnieje"
+
+ Scenario: Edit marker without providing coordinates
+ Given I am logged in as "me@mail.com"
+ And the following markers:
+ | name | description | category | lat | lng |
+ | Moja nazwa | My description | 7 | 50.001 | 20.2 |
+ | Moja inna nazwa | My descr | 6 | 50.011 | 20.8 |
+ And I am on markers page
+ And I follow "Edytuj Moja nazwa"
+ When I fill in "marker_name" with "Moja nowa nazwa"
+ And I fill in "marker_description" with "Moj nowy opis"
+ And I fill in "marker_lat" with ""
+ And I fill in "marker_lng" with ""
+ And I press "Aktualizuj"
+ Then I should see "uzupelnij pole lat"
+ And I should see "uzupelnij pole lng"
+
+ Scenario: Delete manage_markers
+ Given the following markers:
+ | name | description | category | lat | lng |
+ | Moja nazwa | My description | 7 | 50.001 | 20.2 |
+ | Moja inna nazwa | My descr | 6 | 50.011 | 20.8 |
+ | Moja trzecia nazwa | My 3rd descr | 5 | 50.111 | 21.3 |
+ And I am on markers page
+ When I delete the 3rd marker
+ Then I should see "usunieto"
+ And I should see the following markers:
+ | name | description | category | lat | lng |
+ | Moja nazwa | My description | 7 | 50.001 | 20.2 |
+ | Moja inna nazwa | My descr | 6 | 50.011 | 20.8 |
View
16 features/step_definitions/marker_steps.rb
@@ -0,0 +1,16 @@
+Given /^the following markers:$/ do |manage_markers|
+ manage_markers.hashes.each do |hash|
+ Marker.create!(hash)
+ end
+end
+
+When /^I delete the (\d+)(?:st|nd|rd|th) marker$/ do |pos|
+ visit manage_markers_url
+ within("table > tr:nth-child(#{pos.to_i+1})") do
+ click_link "Destroy"
+ end
+end
+
+Then /^I should see the following markers:$/ do |expected_manage_markers_table|
+ expected_manage_markers_table.diff!(table_at('table').to_a)
+end
View
7 features/support/paths.rb
@@ -10,13 +10,18 @@ def path_to(page_name)
when /the homepage/
'/'
-
+
+ when /the new marker page/
+ new_marker_path
+
when /the new user page/
signup_path
when /login page/
login_path
+ when /markers page/
+ markers_path
# Add more mappings here.
# Here is a more fancy example:
Please sign in to comment.
Something went wrong with that request. Please try again.