Skip to content

Commit

Permalink
Change PostsTest integration test into PostsControllerTest functional…
Browse files Browse the repository at this point in the history
… test. That is really what it is and this allows us to use assert_select.
  • Loading branch information
chewi committed Apr 20, 2012
1 parent 96e2087 commit f130bb8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
41 changes: 41 additions & 0 deletions test/functional/posts_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'test_helper'

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

def teardown
@post.destroy
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', { "language": 'en' });!))
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', { "language": 'en',"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', { "height": 400,"language": 'en',"width": 800 });!))
assert_select "textarea#post_info[name='post[info]'][cols=40][rows=20]", "Defaults info content"
assert_select "script", Regexp.new(Regexp.escape(%q!CKEDITOR.replace('post_info', { "language": 'en' });!))
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
41 changes: 0 additions & 41 deletions test/integration/posts_test.rb

This file was deleted.

0 comments on commit f130bb8

Please sign in to comment.