2014-07-27 01:50:22 +02:00
|
|
|
require 'test_helper'
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
# Free Software groups life cycle
|
2015-02-15 17:10:17 +01:00
|
|
|
class OrgasControllerTest < ActionController::TestCase
|
2015-02-28 17:28:05 +01:00
|
|
|
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
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
test 'should get index' do
|
2014-07-27 01:50:22 +02:00
|
|
|
get :index
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
2015-02-28 17:28:05 +01:00
|
|
|
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
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
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
|