forked from railsbridge/bridge_troll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable submit on organizer/checkiner create form when no user selected
The 'Assign' button is now disabled until select2 says something was selected. In the unlikely event that someone submits the form bypassing the disabledness, the controller action will rerender with an error. Fixes railsbridge#416
- Loading branch information
1 parent
05d8d07
commit d151b39
Showing
7 changed files
with
87 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'rails_helper' | ||
|
||
describe CheckinersController do | ||
before do | ||
@event = create(:event) | ||
@user = create(:user) | ||
end | ||
|
||
context "a user that is logged in and is an organizer for a published event" do | ||
before do | ||
@event.organizers << @user | ||
|
||
sign_in @user | ||
end | ||
|
||
it "can see list of checkiners" do | ||
get :index, event_id: @event.id | ||
expect(response).to be_success | ||
end | ||
|
||
describe "assigning checkiners" do | ||
it "can promote a user to checkiner" do | ||
other_user_rsvp = create(:rsvp, event: @event) | ||
expect { | ||
post :create, event_id: @event.id, event_checkiner: {rsvp_id: other_user_rsvp.id} | ||
}.to change { other_user_rsvp.reload.checkiner } | ||
expect(response).to redirect_to(event_checkiners_path(@event)) | ||
end | ||
|
||
it "shows an error if no user is provided" do | ||
post :create, event_id: @event.id | ||
expect(assigns(:event).errors[:base].length).to be >= 1 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters