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