diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fixtures/pages.yml | 15 | ||||
| -rw-r--r-- | test/functional/pages_controller_test.rb | 45 | ||||
| -rw-r--r-- | test/unit/helpers/pages_helper_test.rb | 4 | ||||
| -rw-r--r-- | test/unit/page_test.rb | 5 |
4 files changed, 69 insertions, 0 deletions
diff --git a/test/fixtures/pages.yml b/test/fixtures/pages.yml new file mode 100644 index 0000000..2b1cad1 --- /dev/null +++ b/test/fixtures/pages.yml | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
| 2 | |||
| 3 | one: | ||
| 4 | node_id: 1 | ||
| 5 | title: MyString | ||
| 6 | abstract: MyText | ||
| 7 | body: MyText | ||
| 8 | revision: 1 | ||
| 9 | |||
| 10 | two: | ||
| 11 | node_id: 1 | ||
| 12 | title: MyString | ||
| 13 | abstract: MyText | ||
| 14 | body: MyText | ||
| 15 | revision: 1 | ||
diff --git a/test/functional/pages_controller_test.rb b/test/functional/pages_controller_test.rb new file mode 100644 index 0000000..97ca1b6 --- /dev/null +++ b/test/functional/pages_controller_test.rb | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class PagesControllerTest < ActionController::TestCase | ||
| 4 | test "should get index" do | ||
| 5 | get :index | ||
| 6 | assert_response :success | ||
| 7 | assert_not_nil assigns(:pages) | ||
| 8 | end | ||
| 9 | |||
| 10 | test "should get new" do | ||
| 11 | get :new | ||
| 12 | assert_response :success | ||
| 13 | end | ||
| 14 | |||
| 15 | test "should create page" do | ||
| 16 | assert_difference('Page.count') do | ||
| 17 | post :create, :page => { } | ||
| 18 | end | ||
| 19 | |||
| 20 | assert_redirected_to page_path(assigns(:page)) | ||
| 21 | end | ||
| 22 | |||
| 23 | test "should show page" do | ||
| 24 | get :show, :id => pages(:one).id | ||
| 25 | assert_response :success | ||
| 26 | end | ||
| 27 | |||
| 28 | test "should get edit" do | ||
| 29 | get :edit, :id => pages(:one).id | ||
| 30 | assert_response :success | ||
| 31 | end | ||
| 32 | |||
| 33 | test "should update page" do | ||
| 34 | put :update, :id => pages(:one).id, :page => { } | ||
| 35 | assert_redirected_to page_path(assigns(:page)) | ||
| 36 | end | ||
| 37 | |||
| 38 | test "should destroy page" do | ||
| 39 | assert_difference('Page.count', -1) do | ||
| 40 | delete :destroy, :id => pages(:one).id | ||
| 41 | end | ||
| 42 | |||
| 43 | assert_redirected_to pages_path | ||
| 44 | end | ||
| 45 | end | ||
diff --git a/test/unit/helpers/pages_helper_test.rb b/test/unit/helpers/pages_helper_test.rb new file mode 100644 index 0000000..535dfe1 --- /dev/null +++ b/test/unit/helpers/pages_helper_test.rb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class PagesHelperTest < ActionView::TestCase | ||
| 4 | end | ||
diff --git a/test/unit/page_test.rb b/test/unit/page_test.rb new file mode 100644 index 0000000..af62e93 --- /dev/null +++ b/test/unit/page_test.rb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class PageTest < ActiveSupport::TestCase | ||
| 4 | |||
| 5 | end | ||
