Permalink
Browse files

Merge remote branch 'primerano/master'

  • Loading branch information...
parndt committed Sep 15, 2010
2 parents f70e2b0 + f603c1a commit 091c401eaa946c4b888821d318811aa5abda1bb5
@@ -10,7 +10,8 @@ class Page < ActiveRecord::Base
has_many :parts,
:class_name => "PagePart",
:order => "position ASC",
- :inverse_of => :page
+ :inverse_of => :page,
+ :dependent => :destroy
accepts_nested_attributes_for :parts,
:allow_destroy => true
@@ -39,7 +39,9 @@ Feature: Manage Pages
And I should have a page at /about--2
Scenario: Delete Page
- Given I have a page titled "test"
+ Given I only have a page titled "test"
When I go to the list of pages
And I follow "Remove this page forever"
Then I should see "'test' was successfully destroyed."
+ And I should have 0 pages
+ And I should have 0 page_parts
@@ -16,8 +16,11 @@
Page.delete_all
end
-Given /^I have a page titled "([^"]*)"$/ do |title|
- Page.create(:title => title)
+Given /^I (only )?have a page titled "([^"]*)"$/ do |only, title|
+ Page.delete_all if only
+ page = Page.create(:title => title)
+ page.parts << PagePart.new(:title => 'testing', :position => 0)
+ page
end
Then /^I should have ([0-9]+) pages?$/ do |count|
@@ -27,3 +30,7 @@
Then /^I should have a page at \/(.+)$/ do |url|
Page.all.count{|page| page.url[:path].to_s.include?(url)}.should == 1
end
+
+Then /^I should have (\d+) page_parts$/ do |count|
+ PagePart.count.should == count.to_i
+end

0 comments on commit 091c401

Please sign in to comment.