Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow admins to edit roster membership for other rosters #313

Merged
merged 15 commits into from
Sep 19, 2023
11 changes: 9 additions & 2 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
let(:attributes) { attributes_for :user }

let :submit do
post :create, params: { user: attributes, roster_id: roster.id }
post :create, params: {
user: attributes.merge({ roster_ids: [roster.id] }) do |k, o, n|
next unless k == :roster_ids

o.concat(n)
end,
roster_id: roster.id
werebus marked this conversation as resolved.
Show resolved Hide resolved
}
dirschn marked this conversation as resolved.
Show resolved Hide resolved
end

context 'when the current user is an admin in the roster' do
Expand Down Expand Up @@ -318,7 +325,7 @@

let(:new_roster) { create :roster }
let(:user) { roster_user(new_roster) }
let(:changes) { { phone: '+14135451451', rosters: [roster.id, new_roster.id] } }
let(:changes) { { phone: '+14135451451', roster_ids: [roster.id, new_roster.id] } }

context 'when the current user is an admin in the roster' do
before { when_current_user_is roster_admin(roster) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
sequence(:spire) { |n| format('%[email protected]', n) }
sequence(:email) { |n| "user#{n}@umass.edu" }
sequence(:phone) { |n| format('+1413545%04d', n) }
rosters { [create(:roster)] }
roster_ids { [create(:roster).id] }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using roster_ids now, not rosters

end
end
Loading