summaryrefslogtreecommitdiffstats
path: root/test/unit/attachment_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-03 09:20:05 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-03 09:20:05 +0000
commit14b50dfbabc6b64856ac3511260b787aaf733105 (patch)
treef542733f7cc60e6bd6964989100c8c0d3892e97f /test/unit/attachment_test.rb
parentde8033d18316f2b8fa65b556e36bd74ee9d5f566 (diff)
downloadredmine-14b50dfbabc6b64856ac3511260b787aaf733105.tar.gz
redmine-14b50dfbabc6b64856ac3511260b787aaf733105.zip
Removing shoulda context.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11315 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/attachment_test.rb')
-rw-r--r--test/unit/attachment_test.rb66
1 files changed, 32 insertions, 34 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb
index 30d9e44c7..e32754b7d 100644
--- a/test/unit/attachment_test.rb
+++ b/test/unit/attachment_test.rb
@@ -198,42 +198,40 @@ class AttachmentTest < ActiveSupport::TestCase
assert a.readable?
end
- context "Attachmnet.attach_files" do
- should "attach the file" do
- issue = Issue.first
- assert_difference 'Attachment.count' do
- Attachment.attach_files(issue,
- '1' => {
- 'file' => uploaded_test_file('testfile.txt', 'text/plain'),
- 'description' => 'test'
- })
- end
-
- attachment = Attachment.first(:order => 'id DESC')
- assert_equal issue, attachment.container
- assert_equal 'testfile.txt', attachment.filename
- assert_equal 59, attachment.filesize
- assert_equal 'test', attachment.description
- assert_equal 'text/plain', attachment.content_type
- assert File.exists?(attachment.diskfile)
- assert_equal 59, File.size(attachment.diskfile)
+ test "Attachmnet.attach_files should attach the file" do
+ issue = Issue.first
+ assert_difference 'Attachment.count' do
+ Attachment.attach_files(issue,
+ '1' => {
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'),
+ 'description' => 'test'
+ })
end
- should "add unsaved files to the object as unsaved attachments" do
- # Max size of 0 to force Attachment creation failures
- with_settings(:attachment_max_size => 0) do
- @project = Project.find(1)
- response = Attachment.attach_files(@project, {
- '1' => {'file' => mock_file, 'description' => 'test'},
- '2' => {'file' => mock_file, 'description' => 'test'}
- })
-
- assert response[:unsaved].present?
- assert_equal 2, response[:unsaved].length
- assert response[:unsaved].first.new_record?
- assert response[:unsaved].second.new_record?
- assert_equal response[:unsaved], @project.unsaved_attachments
- end
+ attachment = Attachment.first(:order => 'id DESC')
+ assert_equal issue, attachment.container
+ assert_equal 'testfile.txt', attachment.filename
+ assert_equal 59, attachment.filesize
+ assert_equal 'test', attachment.description
+ assert_equal 'text/plain', attachment.content_type
+ assert File.exists?(attachment.diskfile)
+ assert_equal 59, File.size(attachment.diskfile)
+ end
+
+ test "Attachmnet.attach_files should add unsaved files to the object as unsaved attachments" do
+ # Max size of 0 to force Attachment creation failures
+ with_settings(:attachment_max_size => 0) do
+ @project = Project.find(1)
+ response = Attachment.attach_files(@project, {
+ '1' => {'file' => mock_file, 'description' => 'test'},
+ '2' => {'file' => mock_file, 'description' => 'test'}
+ })
+
+ assert response[:unsaved].present?
+ assert_equal 2, response[:unsaved].length
+ assert response[:unsaved].first.new_record?
+ assert response[:unsaved].second.new_record?
+ assert_equal response[:unsaved], @project.unsaved_attachments
end
end