agenda-libre-ruby/test/controllers/orgas_controller_test.rb

54 lines
1.1 KiB
Ruby
Raw Normal View History

2014-07-27 01:50:22 +02:00
require 'test_helper'
# Free Software groups life cycle
2015-02-15 17:10:17 +01:00
class OrgasControllerTest < ActionController::TestCase
include Devise::TestHelpers
2014-07-27 01:50:22 +02:00
setup do
2015-02-15 17:10:17 +01:00
@orga = orgas :one
2014-07-27 01:50:22 +02:00
end
test 'should get index' do
2014-07-27 01:50:22 +02:00
get :index
assert_response :success
end
test 'should get new' do
sign_in users(:one)
get :new
assert_response :success
end
test 'should create orga' do
sign_in users(:one)
assert_difference 'Orga.count' do
post :create, orga: {
kind_id: @orga.kind_id,
name: @orga.name,
city: @orga.city,
region_id: @orga.region.id,
url: @orga.url,
feed: @orga.feed,
contact: @orga.contact
}
assert_empty assigns(:orga).errors.messages
end
assert_redirected_to :root
end
test 'should not create orga' do
sign_in users(:one)
assert_no_difference 'Orga.count' do
post :create, orga: { url: @orga.url }
assert_not_empty assigns(:orga).errors.messages
end
end
test 'should get show' do
2015-02-15 17:10:17 +01:00
get :show, id: @orga
2014-07-27 01:50:22 +02:00
assert_response :success
end
end