Sha256: 6a21a0d976f597ed7450213fa69a0530e7bc43d05ef4e133017c9510fe4ca553

Contents?: true

Size: 1.61 KB

Versions: 41

Compression:

Stored size: 1.61 KB

Contents

require 'test_helper'

class AttachmentFilesControllerTest < ActionController::TestCase
  tests Ckeditor::AttachmentFilesController
  
  include RawPost
  include ControllerHooks
  
  def setup
    @attachment = fixture_file_upload('files/rails.tar.gz', 'application/x-gzip')
  end
  
  def teardown
    Ckeditor::AttachmentFile.destroy_all
  end
  
  test "index action" do
    get :index
    
    assert_equal 200, @response.status
    assert_template "ckeditor/attachment_files/index"
  end
  
  test "create action via filebrowser" do
    assert_difference 'Ckeditor::AttachmentFile.count' do
      post :create, :qqfile => @attachment
    end
    
    assert_equal 200, @response.status
  end
  
  test "create action via CKEditor upload form" do
    assert_difference 'Ckeditor::AttachmentFile.count' do
      post :create, :upload => @attachment, :CKEditor => 'ckeditor_field'
    end
    
    assert_equal 200, @response.status
  end
  
  test "create action via html5 upload" do
    assert_difference 'Ckeditor::AttachmentFile.count' do
      raw_post :create, { :qqfile => @attachment.original_filename }, @attachment.read
    end
    
    assert_equal 200, @response.status
  end
  
  test "invalid params for create action" do
    assert_no_difference 'Ckeditor::AttachmentFile.count' do
      post :create, :qqfile => nil
    end
  end
  
  test "destroy action via filebrowser" do
    @attachment_file = Ckeditor::AttachmentFile.create :data => @attachment
    
    assert_difference 'Ckeditor::AttachmentFile.count', -1 do
      delete :destroy, :id => @attachment_file.id
    end
    
    assert_equal 302, @response.status
  end
end

Version data entries

41 entries across 41 versions & 4 rubygems

Version Path
ckeditor-4.0.9 test/controllers/attachment_files_controller_test.rb
ckeditor-4.0.8 test/controllers/attachment_files_controller_test.rb
base2_ckeditor-4.0.7 test/controllers/attachment_files_controller_test.rb
ckeditor-4.0.7 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.2.1.5 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.2.1.4 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.2.1.3 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.2.1.2 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.2.1.1 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.2.1 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1.7 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1.6 test/controllers/attachment_files_controller_test.rb
ckeditor-4.0.6 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1.5 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1.4 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1.3 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1.2 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1.1 test/controllers/attachment_files_controller_test.rb
glebtv-ckeditor-4.1.1 test/controllers/attachment_files_controller_test.rb
ckeditor-4.0.4 test/controllers/attachment_files_controller_test.rb