pulling all attributes from page fixtures
Oleg
committed May 02, 2011
commit 25b735b7264ae12fcaea25cee662c9550bd15e5d
Showing 2
changed files with
6 additions
and 2 deletions
comfortable_mexican_sofa/fixtures.rb b/lib/comfortable_mexican_sofa/fixtures.rb
+5
-2
| @@ | @@ -72,11 +72,14 @@ module ComfortableMexicanSofa::Fixtures |
| if page.new_record? || File.mtime(file_path) > page.updated_at | |
| attributes = YAML.load_file(file_path).symbolize_keys! | |
| page.label = attributes[:label] || slug.titleize | |
| - | page.layout = Cms::Layout.find_by_slug(attributes[:layout]) || parent.try(:layout) |
| + | page.layout = site.layouts.find_by_slug(attributes[:layout]) || parent.try(:layout) |
| + | page.target_page = site.pages.find_by_full_path(attributes[:target_page]) |
| + | page.is_published = attributes[:is_published].present?? attributes[:is_published] : true |
| end | |
| elsif page.new_record? | |
| page.label = slug.titleize | |
| - | page.layout = Cms::Layout.find_by_slug(attributes[:layout]) || parent.try(:layout) |
| + | page.layout = site.layouts.find_by_slug(attributes[:layout]) || parent.try(:layout) |
| + | |
| end | |
| # updating content | |
test/unit/fixtures_test.rb
+1
-0
| @@ | @@ -93,6 +93,7 @@ class ViewMethodsTest < ActiveSupport::TestCase |
| assert page = Cms::Page.find_by_full_path('/') | |
| assert_equal 'index', page.slug | |
| assert_equal "<html>Home Page Fixture Content\ndefault_snippet_content</html>", page.content | |
| + | assert page.is_published? |
| assert child_page = Cms::Page.find_by_full_path('/child') | |
| assert_equal page, child_page.parent | |