Sha256: e7677f5098b589060bb8da80811822b85cf71e67dccc7fe6231c3317ea0f6877

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

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[src=/assets/application.js]"
    assert_select "script", Regexp.new(Regexp.escape(%q!CKEDITOR.replace('test_area');!))
  end

  test "pass text_area with options" do
    get :index

    assert_select "textarea#content[name=content][cols=10][rows=20]", "Ckeditor"
    assert_select "script", Regexp.new(Regexp.escape(%q!CKEDITOR.replace('content', {"toolbar":"Easy"});!))
  end

  test "form builder helper" do
    get :new
    
    assert_select "textarea#post_content[name='post[content]'][cols=40][rows=20]", ""
    assert_select "script", Regexp.new(Regexp.escape(%q!CKEDITOR.replace('post_content', {"width":800,"height":400});!))
    assert_select "textarea#new_info_content[name='post[info]'][cols=40][rows=20]", "Defaults info content"
    assert_select "script", Regexp.new(Regexp.escape(%q!CKEDITOR.replace('new_info_content');!))
  end

  test "text_area value" do
    get :edit, :id => @post.id

    assert_select "textarea#post_content[name='post[content]'][cols=40][rows=20]", "content"
    assert_select "textarea#post_info[name='post[info]'][cols=50][rows=70]", "info"
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
ckeditor-4.0.9 test/functional/posts_controller_test.rb
ckeditor-4.0.8 test/functional/posts_controller_test.rb
base2_ckeditor-4.0.7 test/functional/posts_controller_test.rb
ckeditor-4.0.7 test/functional/posts_controller_test.rb
ckeditor-4.0.6 test/functional/posts_controller_test.rb