adjusting tests and things
Oleg
committed Jan 13, 2012
commit 32ec034be2a5ad7eae24d14f134e71337441ccd1
Showing 6
changed files with
32 additions
and 11 deletions
comfortable_mexican_sofa/configuration.rb b/lib/comfortable_mexican_sofa/configuration.rb
+6
-1
| @@ | @@ -62,7 +62,12 @@ class ComfortableMexicanSofa::Configuration |
| @enable_fixtures = false | |
| @fixtures_path = File.expand_path('db/cms_fixtures', Rails.root) | |
| @revisions_limit = 25 | |
| - | @locales = { :en => 'English', :es => 'Español', 'pt-BR' => 'Brazilian Portuguese', 'zh-CN' => '简体中文' } |
| + | @locales = { |
| + | 'en' => 'English', |
| + | 'es' => 'Español', |
| + | 'pt-BR' => 'Português Brasileiro', |
| + | 'zh-CN' => '简体中文' |
| + | } |
| @admin_locale = nil | |
| @database_config = nil | |
| end | |
test/test_helper.rb
+6
-1
| @@ | @@ -34,7 +34,12 @@ class ActiveSupport::TestCase |
| config.enable_fixtures = false | |
| config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root) | |
| config.revisions_limit = 25 | |
| - | config.locales = { :en => 'English', :es => 'Español' } |
| + | config.locales = { |
| + | 'en' => 'English', |
| + | 'es' => 'Español', |
| + | 'pt-BR' => 'Português Brasileiro', |
| + | 'zh-CN' => '简体中文' |
| + | } |
| config.admin_locale = nil | |
| config.upload_file_options = { } | |
| end | |
test/unit/configuration_test.rb
+6
-1
| @@ | @@ -15,7 +15,12 @@ class ConfigurationTest < ActiveSupport::TestCase |
| assert_equal false, config.enable_fixtures | |
| assert_equal File.expand_path('db/cms_fixtures', Rails.root), config.fixtures_path | |
| assert_equal 25, config.revisions_limit | |
| - | assert_equal ({:en => 'English', :es => 'Español'}), config.locales |
| + | assert_equal ({ |
| + | 'en' => 'English', |
| + | 'es' => 'Español', |
| + | 'pt-BR' => 'Português Brasileiro', |
| + | 'zh-CN' => '简体中文' |
| + | }), config.locales |
| assert_equal nil, config.admin_locale | |
| assert_equal nil, config.database_config | |
| assert_equal ({}), config.upload_file_options | |
test/unit/models/file_test.rb
+8
-4
| @@ | @@ -18,27 +18,31 @@ class CmsFileTest < ActiveSupport::TestCase |
| def test_create | |
| assert_difference 'Cms::File.count' do | |
| + | upload = fixture_file_upload('files/image.jpg', 'image/jpeg') |
| + | |
| file = cms_sites(:default).files.create( | |
| - | :file => fixture_file_upload('files/image.jpg', 'image/jpeg') |
| + | :file => upload |
| ) | |
| assert_equal 'Image', file.label | |
| assert_equal 'image.jpg', file.file_file_name | |
| assert_equal 'image/jpeg', file.file_content_type | |
| - | assert file.file_file_size > 6000 |
| + | assert_equal upload.size, file.file_file_size |
| assert_equal 1, file.position | |
| end | |
| end | |
| def test_create_with_dimensions | |
| assert_difference 'Cms::File.count' do | |
| + | upload = fixture_file_upload('files/image.jpg', 'image/jpeg') |
| + | |
| file = cms_sites(:default).files.create!( | |
| :dimensions => '10x10#', | |
| - | :file => fixture_file_upload('files/image.jpg', 'image/jpeg') |
| + | :file => upload |
| ) | |
| assert_equal 'Image', file.label | |
| assert_equal 'image.jpg', file.file_file_name | |
| assert_equal 'image/jpeg', file.file_content_type | |
| - | assert file.file_file_size < 6000 |
| + | assert file.file_file_size < upload.size |
| assert_equal 1, file.position | |
| end | |
| end | |
test/unit/tags/page_file_test.rb
+3
-2
| @@ | @@ -92,17 +92,18 @@ class PageFileTagTest < ActiveSupport::TestCase |
| layout = cms_layouts(:default) | |
| layout.update_attribute(:content, '{{ cms:page_file:file:image[10x10#] }}') | |
| page = cms_pages(:default) | |
| + | upload = fixture_file_upload('files/image.jpg', 'image/jpeg') |
| assert_difference 'Cms::File.count' do | |
| page.update_attributes!( | |
| :blocks_attributes => [ | |
| { :identifier => 'file', | |
| - | :content => fixture_file_upload('files/image.jpg', 'image/jpeg') } |
| + | :content => upload } |
| ] | |
| ) | |
| file = Cms::File.last | |
| assert_equal 'image.jpg', file.file_file_name | |
| - | assert file.file_file_size < 6000 |
| + | assert file.file_file_size < upload.size |
| end | |
| end | |
test/unit/tags/page_files_test.rb
+3
-2
| @@ | @@ -85,17 +85,18 @@ class PageFilesTagTest < ActiveSupport::TestCase |
| layout = cms_layouts(:default) | |
| layout.update_attribute(:content, '{{ cms:page_files:file:image[10x10#] }}') | |
| page = cms_pages(:default) | |
| + | upload = fixture_file_upload('files/image.jpg', 'image/jpeg') |
| assert_difference 'Cms::File.count' do | |
| page.update_attributes!( | |
| :blocks_attributes => [ | |
| { :identifier => 'file', | |
| - | :content => fixture_file_upload('files/image.jpg', 'image/jpeg') } |
| + | :content => upload } |
| ] | |
| ) | |
| file = Cms::File.last | |
| assert_equal 'image.jpg', file.file_file_name | |
| - | assert file.file_file_size < 6000 |
| + | assert file.file_file_size < upload.size |
| end | |
| end | |