Sha256: 73cf93024a64fa8aa8f37c603a66eb193fa86035a0b77451914015a8cddc81d0

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class PostsControllerTest < ActionController::TestCase
  def setup
    @post = Post.create!(title: 'test', content: 'content', info: 'info')
  end

  def teardown
    @post.destroy rescue nil
  end

  test 'include javascripts' do
    get :index

    assert_select 'script', Regexp.new("CKEDITOR\\.replace\\('test_area'")
  end

  test 'pass text_area with options' do
    get :show, params: { id: @post }

    assert_select "textarea[name='content']", 'Ckeditor'
    assert_select 'script', Regexp.new("CKEDITOR\\.replace\\('content',\s\{\"toolbar\":\"Easy\"")
  end

  test 'form builder helper' do
    get :new

    assert_select "textarea[name='post[content]']", ''
    assert_select 'script', Regexp.new("CKEDITOR\\.replace\\('post_content',\s\{\"width\":800,\"height\":400")
    assert_select "textarea[name='post[info]']", 'Defaults info content'
    assert_select 'script', Regexp.new("CKEDITOR\\.replace\\('new_info_content'")
  end

  test 'text_area value' do
    get :edit, params: { id: @post }

    assert_select "textarea[name='post[content]']", 'content'
    assert_select "textarea[name='post[info]']", 'info'
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ckeditor-5.1.3 test/functional/posts_controller_test.rb
ckeditor-5.1.2 test/functional/posts_controller_test.rb
ckeditor-5.1.1 test/functional/posts_controller_test.rb
glebtv-ckeditor-4.14.1 test/functional/posts_controller_test.rb
ckeditor-5.1.0 test/functional/posts_controller_test.rb
glebtv-ckeditor-4.13.1 test/functional/posts_controller_test.rb
glebtv-ckeditor-4.13.0 test/functional/posts_controller_test.rb
ckeditor-5.0.0 test/functional/posts_controller_test.rb