|
14 | 14 | context 'A new member' do
|
15 | 15 | scenario 'is subscribed to the newsletter by default' do
|
16 | 16 | mailing_list = double(:mailing_list)
|
17 |
| - expect(MailingList).to receive(:new).and_return(mailing_list) |
| 17 | + expect(Services::MailingList).to receive(:new).and_return(mailing_list) |
18 | 18 | expect(mailing_list).to receive(:subscribe).with('[email protected]', 'Jane', 'Doe')
|
19 | 19 |
|
20 | 20 | visit new_member_path
|
|
33 | 33 |
|
34 | 34 | scenario 'can opt out of the newsletter' do
|
35 | 35 | mailing_list = double(:mailing_list)
|
36 |
| - expect(MailingList).to receive(:new).and_return(mailing_list) |
| 36 | + expect(Services::MailingList).to receive(:new).and_return(mailing_list) |
37 | 37 | expect(mailing_list).to receive(:unsubscribe).with('[email protected]')
|
38 | 38 |
|
39 | 39 | visit new_member_path
|
|
60 | 60 | login member
|
61 | 61 |
|
62 | 62 | mailing_list = double(:mailing_list)
|
63 |
| - expect(MailingList).to receive(:new).and_return(mailing_list) |
| 63 | + expect(Services::MailingList).to receive(:new).and_return(mailing_list) |
64 | 64 | expect(mailing_list).to receive(:subscribe)
|
65 | 65 |
|
66 | 66 | visit subscriptions_path
|
|
75 | 75 | login member
|
76 | 76 |
|
77 | 77 | mailing_list = double(:mailing_list)
|
78 |
| - expect(MailingList).to receive(:new).and_return(mailing_list) |
| 78 | + expect(Services::MailingList).to receive(:new).and_return(mailing_list) |
79 | 79 | expect(mailing_list).to receive(:unsubscribe)
|
80 | 80 |
|
81 | 81 | visit subscriptions_path
|
|
90 | 90 | login member
|
91 | 91 |
|
92 | 92 | mailing_list = double(:mailing_list)
|
93 |
| - expect(MailingList).to receive(:new).and_return(mailing_list) |
| 93 | + expect(Services::MailingList).to receive(:new).and_return(mailing_list) |
94 | 94 | expect(mailing_list).to receive(:subscribe)
|
95 | 95 |
|
96 | 96 | visit subscriptions_path
|
97 | 97 | click_on 'Subscribe to newsletter'
|
98 | 98 |
|
99 | 99 | expect(page).to have_content('You have subscribed to codebar\'s newsletter')
|
100 | 100 |
|
101 |
| - expect(MailingList).to receive(:new).and_return(mailing_list) |
| 101 | + expect(Services::MailingList).to receive(:new).and_return(mailing_list) |
102 | 102 | expect(mailing_list).to receive(:unsubscribe)
|
103 | 103 |
|
104 | 104 | click_on 'Unsubscribe from newsletter'
|
|
0 commit comments