Sha256: 5514f0cb26f753e0ea5b8a1a9f14e6f3f5f6476614962a82d198b19407289033

Contents?: true

Size: 1.5 KB

Versions: 24

Compression:

Stored size: 1.5 KB

Contents

require 'test_helper'

class PicturesControllerTest < ActionController::TestCase
  tests Ckeditor::PicturesController

  include RawPost
  include Ckeditor::Engine.routes.url_helpers
  include ControllerHooks

  def setup
    @image = fixture_file_upload('files/rails.png', 'image/png')
  end

  def teardown
    Ckeditor::Picture.destroy_all
  end

  test "index action" do
    get :index

    assert_equal 200, @response.status
    assert_template "ckeditor/pictures/index"
  end

  test "create action via filebrowser" do
    assert_difference 'Ckeditor::Picture.count' do
      post :create, :qqfile => @image
    end

    assert_equal 200, @response.status
  end

  test "create action via CKEditor upload form" do
    assert_difference 'Ckeditor::Picture.count' do
      post :create, :upload => @image, :CKEditor => 'ckeditor_field'
    end

    assert_equal 200, @response.status
  end

  test "create action via html5 upload" do
    assert_difference 'Ckeditor::Picture.count' do
      raw_post :create, { :qqfile => @image.original_filename }, @image.read, "image/png"
    end

    assert_equal 200, @response.status
  end

  test "invalid params for create action" do
    assert_no_difference 'Ckeditor::Picture.count' do
      post :create, :qqfile => nil
    end
  end

  test "destroy action via filebrowser" do
    @picture = Ckeditor::Picture.create :data => @image

    assert_difference 'Ckeditor::Picture.count', -1 do
      delete :destroy, :id => @picture.id
    end

    assert_equal 302, @response.status
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
ckeditor-4.1.3 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.7.4 test/controllers/pictures_controller_test.rb
ckeditor-4.1.2 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.7.3 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.7.2 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.7.1 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.7 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.6 test/controllers/pictures_controller_test.rb
ckeditor-4.1.1 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.3.4 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.3.3 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.3.2 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.3.1 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.4.3.0 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.3.2.6 test/controllers/pictures_controller_test.rb
ckeditor-4.1.0 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.3.2.5 test/controllers/pictures_controller_test.rb
ckeditor-4.0.11 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.3.2.4 test/controllers/pictures_controller_test.rb
glebtv-ckeditor-4.3.2.3 test/controllers/pictures_controller_test.rb