def test_moderators_can_create
session[:user] = users(:moderator_user).id
- cookies["_osm_username"] = users(:moderator_user).display_name
post :create, :redaction => { :title => "Foo", :description => "Description here." }
assert_response :redirect
def test_non_moderators_cant_create
session[:user] = users(:public_user).id
- cookies["_osm_username"] = users(:public_user).display_name
post :create, :redaction => { :title => "Foo", :description => "Description here." }
assert_response :forbidden
def test_moderators_can_delete_empty
session[:user] = users(:moderator_user).id
- cookies["_osm_username"] = users(:moderator_user).display_name
# remove all elements from the redaction
redaction = redactions(:example)
def test_moderators_cant_delete_nonempty
session[:user] = users(:moderator_user).id
- cookies["_osm_username"] = users(:moderator_user).display_name
# leave elements in the redaction
redaction = redactions(:example)
def test_non_moderators_cant_delete
session[:user] = users(:public_user).id
- cookies["_osm_username"] = users(:public_user).display_name
delete :destroy, :id => redactions(:example).id
assert_response :forbidden
def test_moderators_can_edit
session[:user] = users(:moderator_user).id
- cookies["_osm_username"] = users(:moderator_user).display_name
get :edit, :id => redactions(:example).id
assert_response :success
def test_non_moderators_cant_edit
session[:user] = users(:public_user).id
- cookies["_osm_username"] = users(:public_user).display_name
get :edit, :id => redactions(:example).id
assert_response :redirect
def test_moderators_can_update
session[:user] = users(:moderator_user).id
- cookies["_osm_username"] = users(:moderator_user).display_name
redaction = redactions(:example)
def test_non_moderators_cant_update
session[:user] = users(:public_user).id
- cookies["_osm_username"] = users(:public_user).display_name
redaction = redactions(:example)