spec/models/refinery/page_spec.rb in refinerycms-pages-2.0.3 vs spec/models/refinery/page_spec.rb in refinerycms-pages-2.0.4
- old
+ new
@@ -409,7 +409,26 @@
page.not_in_menu?.should be_true
end
end
end
+ describe '.find_by_path' do
+ let(:page_title) { 'team' }
+ let(:child_title) { 'about' }
+ let(:created_root_about) { subject.class.create!(:title => child_title, :deletable => true) }
+
+ before(:each) do
+ # Ensure pages are created.
+ created_child
+ created_root_about
+ end
+
+ it "should return (root) about page when looking for '/about'" do
+ Refinery::Page.find_by_path('/about').should == created_root_about
+ end
+
+ it "should return child about page when looking for '/team/about'" do
+ Refinery::Page.find_by_path('/team/about').should == created_child
+ end
+ end
end
end