mirror of
https://github.com/wahyd4/ocelots.git
synced 2026-08-09 13:06:25 +10:00
fix a bug that person add a team with nil name
This commit is contained in:
@@ -18,28 +18,4 @@ $ ->
|
||||
|
||||
$('.fancybox').fancybox()
|
||||
|
||||
# $("#map_canvas").each ->
|
||||
# lat = parseFloat($('#person_lat').val()) || -34.397
|
||||
# lng = parseFloat($('#person_lng').val()) || 150.644
|
||||
#
|
||||
# map_options = {
|
||||
# center: new google.maps.LatLng(lat, lng),
|
||||
# zoom: 8,
|
||||
# mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
# }
|
||||
#
|
||||
# map = new google.maps.Map(this, map_options)
|
||||
#
|
||||
# marker_options = {
|
||||
# draggable: true,
|
||||
# position: new google.maps.LatLng(lat, lng),
|
||||
# map: map
|
||||
# }
|
||||
# marker = new google.maps.Marker(marker_options)
|
||||
#
|
||||
# google.maps.event.addListener marker, 'dragend', (event) ->
|
||||
# point = marker.getPosition()
|
||||
# $('#person_lat').val point.lat()
|
||||
# $('#person_lng').val point.lng()
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ class TeamsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@teams = current_person.teams
|
||||
@team = Team.new params[:team].merge creator: current_person
|
||||
if @team.save
|
||||
@@ -23,6 +22,7 @@ class TeamsController < ApplicationController
|
||||
|
||||
redirect_to "/teams/#{@team.slug}"
|
||||
else
|
||||
@memberships = current_person.memberships
|
||||
render :index
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,6 +54,21 @@ describe TeamsController do
|
||||
new_team.name.should == 'CDI'
|
||||
new_team.organisations.first.should == @organisation
|
||||
end
|
||||
|
||||
it 'not create team with null name' do
|
||||
lambda do
|
||||
post :create, team: {name: nil, slug: 'cdi'}, org_ids: [@organisation.id.to_s]
|
||||
end.should_not change(Team, :count)
|
||||
assigns(:memberships).should_not be_nil
|
||||
end
|
||||
|
||||
it 'not create team with null name' do
|
||||
lambda do
|
||||
post :create, team: {name: 'CDI', slug: nil}, org_ids: [@organisation.id.to_s]
|
||||
end.should_not change(Team, :count)
|
||||
assigns(:memberships).should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe :join do
|
||||
|
||||
Reference in New Issue
Block a user