Skip to content

Commit

Permalink
[ci] Use data attrs in feature spec.
Browse files Browse the repository at this point in the history
To stop the spec from failing everytime you add a new receiver role or event type to the form.
Also removed a failing test because it was pointless - just testing what the value of a class
variable was defined as.
  • Loading branch information
Evan Rolfe committed Oct 13, 2017
1 parent c5bf75a commit d08fe98
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
= fields_for "subscriptions[#{i}]", subscription do |f|
%li
= f.label :receive, subscription.receiver_role
= f.select :channel, EventSubscription.channels.keys
= f.select :channel, EventSubscription.channels.keys, {}, { data: { eventtype: subscription.eventtype, receiver_role: subscription.receiver_role } }
= f.hidden_field :eventtype
= f.hidden_field :receiver_role
- i += 1
13 changes: 7 additions & 6 deletions src/api/spec/features/webui/notifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

expect(page).to have_content('Events to get email for')

%w(subscriptions_8_channel
subscriptions_7_channel
subscriptions_14_channel
subscriptions_15_channel
).each do |select_id|
select('instant_email', from: select_id)
[
['Event::CommentForPackage', 'commenter'],
['Event::CommentForProject', 'maintainer'],
['Event::CommentForRequest', 'reviewer'],
['Event::BuildFail', 'maintainer']
].each do |eventtype, receiver_role|
find("select[data-eventtype='#{eventtype}'][data-receiver-role='#{receiver_role}']").find(:option, 'instant_email').select_option
end

click_button 'Update'
Expand Down
4 changes: 0 additions & 4 deletions src/api/test/models/event_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ def setup
assert_equal [], e.receiver_roles
end

test 'receive roles for build failure' do
assert_equal %i(maintainer bugowner reader), events(:build_fails_with_deleted_user_and_request).receiver_roles
end

def users_for_event(e)
users = EventSubscription::FindForEvent.new(e).subscriptions.map(&:subscriber)
User.where(id: users).pluck(:login).sort
Expand Down

0 comments on commit d08fe98

Please sign in to comment.