Browse files

continue tests creation

  • Loading branch information...
1 parent 520d03e commit 6c12ce4ebd1f805be24c949cdefa06c34d031acb @khustochka committed Jan 3, 2010
Showing with 34 additions and 2 deletions.
  1. +5 −1 config/admin_config.sample.yml
  2. +25 −1 features/access_restriction.feature
  3. +4 −0 features/step_definitions/web_steps.rb
View
6 config/admin_config.sample.yml
@@ -25,7 +25,11 @@ production:
test: &TEST
<<: *DEFAULT
- <<: *SAFE
+ open_access: false
+ admin_username: admin
+ admin_password: secret2pwd
+ admin_session_ask: are_you_admin
+ admin_session_reply: Yes,_of_course!
cucumber:
<<: *TEST
View
26 features/access_restriction.feature
@@ -13,10 +13,16 @@ Feature: Restricted access to administration parts for external users
Scenario: User with invalid credentials should not see Admin dashboard
- Given logged as "someuser" with password "any4passwd"
+ Given logged as "admin" with password "any4passwd"
When I go to Admin dashboard
Then I should get "401 Unauthorized" response status
+ Scenario: User with admin credentials should see Admin dashboard
+
+ Given logged as "admin" with password "secret2pwd"
+ When I go to Admin dashboard
+ Then I should get "200 OK" response status
+
Scenario: Unauthorized user should not see Ordines Index
When I go to Ordines Index
@@ -40,4 +46,22 @@ Feature: Restricted access to administration parts for external users
Scenario: Unauthorized user should not see New Species page
When I go to New Species page
+ Then I should see 404 status page
+
+ Scenario: Unauthorized user should not create new ordo
+
+ When I post the following to '/admin/ordines':
+ | name_la | Noviformes |
+ Then I should see 404 status page
+
+ Scenario: Unauthorized user should not create new familia
+
+ When I post the following to '/admin/familiae':
+ | name_la | Novidae |
+ Then I should see 404 status page
+
+ Scenario: Unauthorized user should not create new species
+
+ When I post the following to '/admin/species':
+ | name_la | Novus novissimus |
Then I should see 404 status page
View
4 features/step_definitions/web_steps.rb
@@ -142,6 +142,10 @@
attach_file(field, path, type)
end
+When /I post the following to '(.*)':/ do |url, table|
+ post url, table.rows_hash
+end
+
Then /^(?:|I )should see "([^\"]*)"$/ do |text|
if defined?(Spec::Rails::Matchers)
response.should contain(text)

0 comments on commit 6c12ce4

Please sign in to comment.