Added a passing feature for adding a domain. Failing one for removing a domain.

This commit is contained in:
Mario Visic 2012-04-02 19:57:24 +08:00
parent 114218b8c4
commit f134601306
2 changed files with 52 additions and 16 deletions

View File

@ -3,21 +3,31 @@ Feature: Manage my site
As an administrator As an administrator
I want to edit/delete my site I want to edit/delete my site
Background: Background:
Given I have the site: "test site" set up Given I have the site: "test site" set up
And I am an authenticated user
Scenario: Site settings are not accessible for non authenticated accounts Scenario: Site settings are not accessible for non authenticated accounts
Given I am not authenticated Given I am not authenticated
When I go to the site settings When I go to the site settings
Then I should see "You need to sign in or sign up before continuing" Then I should see "You need to sign in or sign up before continuing"
Scenario: Add a new site Scenario: Add a new site
Given I go to the account settings Given I am an authenticated user
And I follow "new site" When I go to the account settings
Then I should see "Fill in the form below to create your new site." And I follow "new site"
When I fill in "Name" with "Acme" Then I should see "Fill in the form below to create your new site."
And I fill in "Subdomain" with "acme" When I fill in "Name" with "Acme"
And I press "Create" And I fill in "Subdomain" with "acme"
Then I should see "Site was successfully created." And I press "Create"
And I should be a administrator of the "Acme" site Then I should see "Site was successfully created."
And I should be a administrator of the "Acme" site
@javascript
Scenario: Adding a domain to a site
Given I am an authenticated user
Then I should be able to add a domain to my site
@javascript
Scenario: Removing a domain from a site
Given I am an authenticated user
Then I should be able to remove a domain from my site

View File

@ -33,3 +33,29 @@ end
Given /^a robot_txt set to "([^"]*)"$/ do |value| Given /^a robot_txt set to "([^"]*)"$/ do |value|
@site.update_attributes(:robots_txt => value) @site.update_attributes(:robots_txt => value)
end end
Then /^I should be able to add a domain to my site$/ do
visit edit_current_site_path
fill_in 'domain', :with => 'monkeys.com'
click_link '+ add'
click_button 'Save'
page.should have_content 'My site was successfully updated'
@site.reload.domains.should include 'monkeys.com'
end
Then /^I should be able to remove a domain from my site$/ do
@site.domains = [ 'monkeys.com' ]
@site.save!
visit edit_current_site_path
click_link 'x'
click_button 'Save'
page.should have_content 'My site was successfully updated'
@site.reload.domains.should be_blank
end