-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathfeedback_requests_spec.rb
More file actions
47 lines (37 loc) · 1.16 KB
/
feedback_requests_spec.rb
File metadata and controls
47 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'FeedbackRequests', type: :feature do
include Webmocks
let!(:plan) { create(:plan, :organisationally_visible) }
let!(:org) do
create(:org, feedback_enabled: true,
feedback_msg: Faker::Lorem.paragraph)
end
let!(:user) { create(:user, org: org) }
before do
plan.roles << create(:role, :commenter, :creator, :editor, :administrator, user: user)
sign_in(user)
ActionMailer::Base.deliveries = []
stub_openaire
end
after do
ActionMailer::Base.deliveries = []
end
scenario 'User requests feedback for Plan', :js do
# Actions
click_link plan.title
expect(current_path).to eql(plan_path(plan))
# Click "Request feedback" tab
within('ul.nav.nav-tabs') do
click_link 'Request feedback'
end
# Click "Request feedback" button within panel
within('.tab-pane.active') do
click_link 'Request feedback'
end
# Expectations
expect(page).to have_content('Feedback has been requested.')
expect(plan.reload).to be_feedback_requested
expect(ActionMailer::Base.deliveries).to have_exactly(1).item
end
end