Skip to content

Commit

Permalink
Merge pull request locomotivecms#475 from colibri-software/fix_remove…
Browse files Browse the repository at this point in the history
…_membership

Fixed issue with removing membership from a site
  • Loading branch information
did committed Jul 23, 2012
2 parents c24761e + b695e3b commit 0c0fc46
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/assets/javascripts/locomotive/models/site.js.coffee
Expand Up @@ -13,7 +13,8 @@ class Locomotive.Models.Site extends Backbone.Model

@set domains: domains, memberships: memberships

includes_domain: (name) ->
includes_domain: (name_with_port) ->
name = name_with_port.replace(/:[0-9]*/, '')
name == @domain_with_domain() || _.any(@get('domains'), (domain) -> domain.get('name') == name)

domain_with_domain: ->
Expand Down
5 changes: 5 additions & 0 deletions features/backoffice/site.feature
Expand Up @@ -31,3 +31,8 @@ Feature: Manage my site
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

@javascript
Scenario: Removing a membership
Given I am an authenticated user
Then I should be able to remove a membership from my site
13 changes: 13 additions & 0 deletions features/step_definitions/site_steps.rb
Expand Up @@ -57,3 +57,16 @@
page.should have_content 'My site was successfully updated'
@site.reload.domains_without_subdomain.should be_blank
end

Then /^I should be able to remove a membership from my site$/ do
@new_account = FactoryGirl.create(:author, :site => @site)
@site.save!

visit edit_current_site_path

click_link 'x'
click_button 'Save'

page.should have_content 'My site was successfully updated'
@site.reload.memberships.collect(&:account).should_not include(@new_account)
end

0 comments on commit 0c0fc46

Please sign in to comment.