0
@@ -5,7 +5,7 @@ require 'admin/articles_controller'
0
class Admin::ArticlesController; def rescue_action(e) raise e end; end
0
class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
- fixtures :contents, :content_versions, :sections, :assigned_sections, :users, :sites, :tags, :taggings, :memberships
0
+ fixtures :contents, :content_versions, :sections, :assigned_sections, :users, :sites, :tags, :taggings, :memberships
, :assigned_assets, :assets0
@controller = Admin::ArticlesController.new
0
@@ -15,7 +15,7 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
FileUtils.mkdir_p ASSET_PATH
0
-
def test_should_upload_asset0
+
specify "should upload asset" do0
asset_count = has_image_processor? ? 3 : 1 # asset + 2 thumbnails
0
assert_difference Asset, :count, asset_count do
0
@@ -25,7 +25,7 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
-
def test_should_upload_asset_and_redirect_to_article0
+
specify "should upload asset and redirect to article" do0
asset_count = has_image_processor? ? 3 : 1 # asset + 2 thumbnails
0
assert_difference Asset, :count, asset_count do
0
@@ -37,7 +37,7 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
-
def test_should_upload_asset_as_member0
+
specify "should upload asset as member" do0
asset_count = has_image_processor? ? 3 : 1 # asset + 2 thumbnails
0
@@ -48,7 +48,7 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
-
def test_should_upload_asset_and_redirect_to_article_as_member0
+
specify "should upload asset and redirect to article as member" do0
asset_count = has_image_processor? ? 3 : 1 # asset + 2 thumbnails
0
@@ -61,7 +61,7 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
-
def test_should_not_error_on_new_article_asset_upload0
+
specify "should not error on new article asset upload" do0
assert_no_difference Asset, :count do
0
assert_response :success
0
@@ -69,7 +69,7 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
-
def test_should_not_error_on_article_asset_upload0
+
specify "should not error on article asset upload" do0
assert_no_difference Asset, :count do
0
post :upload, :id => contents(:welcome).id
0
assert_response :success
0
@@ -78,7 +78,7 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
-
def test_should_not_create_article_when_uploading_asset0
+
specify "should not create article when uploading asset" do0
Time.mock! Time.local(2005, 1, 1, 12, 0, 0) do
0
assert_no_difference Article, :count do
0
post :upload, :asset => { :uploaded_data => fixture_file_upload('assets/logo.png', 'image/png') },
0
@@ -94,6 +94,29 @@ class Admin::ArticlesControllerAssetsTest < Test::Unit::TestCase
0
+ specify "should add asset to article" do
0
+ assert_difference AssignedAsset, :count do
0
+ post :attach, :id => contents(:welcome).id, :version => assets(:mov).id, :label => 'avatar'
0
+ assert_models_equal [assets(:gif), assets(:mp3), assets(:mov)], contents(:welcome).assets(true)
0
+ assert_equal 'avatar', contents(:welcome).assets[2].label
0
+ specify "should add inactive asset to article" do
0
+ assert_no_difference AssignedAsset, :count do
0
+ post :attach, :id => contents(:welcome).id, :version => assets(:png).id, :label => 'avatar'
0
+ assert_models_equal [assets(:gif), assets(:mp3), assets(:png)], contents(:welcome).assets(true)
0
+ assert_equal 'avatar', contents(:welcome).assets[2].label
0
+ specify "should find deactivate article assets" do
0
+ assert_no_difference AssignedAsset, :count do
0
+ post :detach, :id => contents(:welcome).id, :version => assets(:mp3).id
0
+ assert_models_equal [assets(:gif)], contents(:welcome).assets
0
FileUtils.rm_rf ASSET_PATH