Sha256: 17aea11f46b7f01bedbebfa8a2853b6a1fa4c2f45d98e9e8bf2f0d1c5080c166

Contents?: true

Size: 1.26 KB

Versions: 13

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

class RelationsControllerTest < Zena::Controller::TestCase

  def setup
    super
    login(:lion)
  end

  def test_should_get_index
    get :index
    assert_response :success
    assert assigns(:relations)
  end

  def test_should_not_find_index_if_not_admin
    login(:tiger)
    get :index
    assert_response :missing
  end

  def test_should_get_new
    get :new
    assert_response :success
  end

  def test_should_create_relation
    assert_difference('Relation.count', 1) do
      post :create, :relation => {:source_role => 'wife', :target_role => 'husband'}
    end
    assert_redirected_to relation_path(assigns(:relation))
  end

  def test_should_show_relation
    get :show, :id => relations_id(:node_has_tags)
    assert_response :success
  end

  def test_should_get_edit
    get :edit, :id => relations_id(:node_has_tags)
    assert_response :success
  end

  def test_should_update_relation
    put :update, :id => relations_id(:node_has_tags), :relation => {:source_role => 'taga' }
    assert_redirected_to relation_path(assigns(:relation))
  end

  def test_should_destroy_relation
    assert_difference('Relation.count', -1) do
      delete :destroy, :id => relations_id(:node_has_tags)
    end
    assert_redirected_to relations_path
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
zena-0.16.9 test/functional/relations_controller_test.rb
zena-0.16.8 test/functional/relations_controller_test.rb
zena-0.16.7 test/functional/relations_controller_test.rb
zena-0.16.6 test/functional/relations_controller_test.rb
zena-0.16.5 test/functional/relations_controller_test.rb
zena-0.16.4 test/functional/relations_controller_test.rb
zena-0.16.3 test/functional/relations_controller_test.rb
zena-0.16.2 test/functional/relations_controller_test.rb
zena-0.16.1 test/functional/relations_controller_test.rb
zena-0.16.0 test/functional/relations_controller_test.rb
zena-0.15.2 test/functional/relations_controller_test.rb
zena-0.15.1 test/functional/relations_controller_test.rb
zena-0.15.0 test/functional/relations_controller_test.rb