more tests
Oleg
committed May 05, 2011
commit f49ba5c81976c1b6feeefff10fc2a14acd44b86c
Showing 2
changed files with
23 additions
and 3 deletions
comfortable_mexican_sofa.rb b/lib/comfortable_mexican_sofa.rb
+7
-3
| @@ | @@ -1,5 +1,9 @@ |
| - | [ 'comfortable_mexican_sofa/engine', |
| - | 'comfortable_mexican_sofa/configuration', |
| + | # Loading engine only if this is not a standalone installation |
| + | unless defined? ComfortableMexicanSofa::Application |
| + | require File.expand_path('comfortable_mexican_sofa/engine', File.dirname(__FILE__)) |
| + | end |
| + | |
| + | [ 'comfortable_mexican_sofa/configuration', |
| 'comfortable_mexican_sofa/http_auth', | |
| 'comfortable_mexican_sofa/rails_extensions', | |
| 'comfortable_mexican_sofa/controller_methods', | |
| @@ | @@ -23,7 +27,7 @@ module ComfortableMexicanSofa |
| # Modify CMS configuration | |
| # Example: | |
| # ComfortableMexicanSofa.configure do |config| | |
| - | # config.cms_title = 'Comfortable Mexican Sofa' |
| + | # config.cms_title = 'ComfortableMexicanSofa' |
| # end | |
| def configure | |
| yield configuration | |
test/unit/fixtures_test.rb
+16
-0
| @@ | @@ -7,6 +7,20 @@ class ViewMethodsTest < ActiveSupport::TestCase |
| @site.update_attribute(:hostname, 'example.com') | |
| end | |
| + | def test_sync |
| + | Cms::Page.destroy_all |
| + | Cms::Layout.destroy_all |
| + | Cms::Snippet.destroy_all |
| + | |
| + | assert_difference 'Cms::Layout.count', 2 do |
| + | assert_difference 'Cms::Page.count', 2 do |
| + | assert_difference 'Cms::Snippet.count', 1 do |
| + | ComfortableMexicanSofa::Fixtures.sync(@site) |
| + | end |
| + | end |
| + | end |
| + | end |
| + | |
| def test_sync_layouts_creating | |
| Cms::Layout.delete_all | |
| @@ | @@ -91,12 +105,14 @@ class ViewMethodsTest < ActiveSupport::TestCase |
| ComfortableMexicanSofa::Fixtures.sync_pages(@site) | |
| assert page = Cms::Page.find_by_full_path('/') | |
| + | assert_equal layout, page.layout |
| 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 | |
| + | assert_equal nested, child_page.layout |
| assert_equal 'child', child_page.slug | |
| assert_equal '<html>Child Page Left Fixture Content<br/>Child Page Right Fixture Content</html>', child_page.content | |
| end | |