-
-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathfeedback_request_spec.rb
More file actions
37 lines (30 loc) · 1.07 KB
/
feedback_request_spec.rb
File metadata and controls
37 lines (30 loc) · 1.07 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
RSpec.describe FeedbackRequest do
subject { Fabricate(:feedback_request) }
it { should respond_to(:member) }
it { should respond_to(:workshop) }
it { should respond_to(:token) }
it { should respond_to(:submited) }
context 'validations' do
context 'presence' do
it '#workshop should not be blank' do
feedback_request = Fabricate.build(:feedback_request, workshop: nil)
expect(feedback_request).to_not be_valid
expect(feedback_request).to have(1).error_on(:workshop)
end
it '#submitted should not be blank' do
feedback_request = Fabricate.build(:feedback_request, submited: nil)
expect(feedback_request).to_not be_valid
expect(feedback_request).to have(1).error_on(:submited)
end
end
end
context 'after create hook' do
it 'sends request feedback email' do
expect {
Fabricate(:feedback_request)
}.to change { ActionMailer::Base.deliveries.count }.by(1)
email = ActionMailer::Base.deliveries.last
expect(email.subject).to include('Feedback')
end
end
end