From be47a4bbeac59d85af16b5e83e10ff242628519d Mon Sep 17 00:00:00 2001 From: hukl Date: Thu, 29 Jan 2009 22:12:11 +0100 Subject: added node model to make basic functional tests pass. added awesome_nested_set plugin --- test/fixtures/nodes.yml | 8 ++++++++ test/functional/content_controller_test.rb | 23 ++++++++++++----------- test/unit/node_test.rb | 8 ++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 test/fixtures/nodes.yml create mode 100644 test/unit/node_test.rb (limited to 'test') diff --git a/test/fixtures/nodes.yml b/test/fixtures/nodes.yml new file mode 100644 index 0000000..9879d9f --- /dev/null +++ b/test/fixtures/nodes.yml @@ -0,0 +1,8 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + id: 1 + lft: 1 + rgt: 2 + slug: my_first_page + unique_name: root/my_first_page diff --git a/test/functional/content_controller_test.rb b/test/functional/content_controller_test.rb index c44b221..15e1299 100644 --- a/test/functional/content_controller_test.rb +++ b/test/functional/content_controller_test.rb @@ -7,15 +7,16 @@ class ContentControllerTest < ActionController::TestCase assert_recognizes({ :controller => 'content', :action => 'render_page', :language => 'en', :pagepath => ['home'] }, '/en/home') end - # def test_rendering_a_page - # Page.destroy_all - # load_atp 'content_controller' - # Page.all.each {|x| x.update_unique_name; x.save} - # assert Page.valid? - # assert_not_nil Page.find_by_title("short name yo") - # get :render_page, :language => 'de', :pagepath => ["shortname","barfoo"] - # assert_response :success - # assert_template 'wtp_eins' - # assert_equal "page_templates/layouts/screen", @response.layout - # end + def test_render_404_when_no_page_was_found + get :render_page, :language => 'de', :page_path => ["wrong_path"] + assert_response 404 + end + + def test_rendering_a_page + assert Node.valid? + assert_not_nil Node.find_by_slug("my_first_page") + get :render_page, :language => 'de', :page_path => ["root", "my_first_page"] + assert_response :success + assert_equal "layouts/application", @response.layout + end end diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb new file mode 100644 index 0000000..a311b84 --- /dev/null +++ b/test/unit/node_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class NodeTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end -- cgit v1.3