|
109 | 109 | end |
110 | 110 | end |
111 | 111 | end |
112 | | - |
113 | | - describe "request approval with invalid details" do |
114 | | - let(:partner_user) { partner.primary_user } |
115 | | - let(:partner) { FactoryBot.create(:partner) } |
116 | | - |
117 | | - before do |
118 | | - login_as(partner_user) |
119 | | - visit partner_user_root_path |
120 | | - click_on 'My Profile' |
121 | | - end |
122 | | - |
123 | | - subject { all('button', text: 'Submit for Approval').last.click } |
124 | | - |
125 | | - context "Social media information is absent" do |
126 | | - before do |
127 | | - partner.profile.update(website: '', facebook: '', twitter: '', instagram: '', no_social_media_presence: false) |
128 | | - end |
129 | | - |
130 | | - context "partner status is invited" do |
131 | | - before do |
132 | | - partner.update(status: :invited) |
133 | | - end |
134 | | - |
135 | | - it "should render an error message", :aggregate_failures do |
136 | | - subject |
137 | | - assert page.has_content? 'No social media presence must be checked if you have not provided any of Website, Twitter, Facebook, or Instagram.' |
138 | | - end |
139 | | - |
140 | | - context "partner's organization one_step_partner_invite is true" do |
141 | | - before do |
142 | | - partner.organization.update(one_step_partner_invite: true) |
143 | | - end |
144 | | - |
145 | | - it "should render an error message about social media presence only", :aggregate_failures do |
146 | | - subject |
147 | | - assert page.has_content? 'You have submitted your details for approval.' |
148 | | - end |
149 | | - end |
150 | | - end |
151 | | - |
152 | | - context "partner status is awaiting_review" do |
153 | | - before do |
154 | | - partner.update(status: :awaiting_review) |
155 | | - end |
156 | | - |
157 | | - it "should render an error message", :aggregate_failures do |
158 | | - subject |
159 | | - assert page.has_content? 'This partner has already requested approval.' |
160 | | - end |
161 | | - end |
162 | | - end |
163 | | - |
164 | | - context "Mandatory fields are empty" do |
165 | | - before do |
166 | | - partner.update(name: '') |
167 | | - partner.profile.update( |
168 | | - agency_type: '', |
169 | | - address1: '', |
170 | | - city: '', |
171 | | - state: '', |
172 | | - zip_code: '', |
173 | | - program_name: '', |
174 | | - program_description: '' |
175 | | - ) |
176 | | - end |
177 | | - |
178 | | - context "partner status is invited" do |
179 | | - before do |
180 | | - partner.update(status: :invited) |
181 | | - end |
182 | | - |
183 | | - it "should render error messages for each missing field", :aggregate_failures do |
184 | | - subject |
185 | | - assert page.has_content? "Name can't be blank" |
186 | | - assert page.has_content? "Agency type can't be blank" |
187 | | - assert page.has_content? "Address1 can't be blank" |
188 | | - assert page.has_content? "City can't be blank" |
189 | | - assert page.has_content? "State can't be blank" |
190 | | - assert page.has_content? "Zip code can't be blank" |
191 | | - assert page.has_content? "Program name can't be blank" |
192 | | - assert page.has_content? "Program description can't be blank" |
193 | | - end |
194 | | - end |
195 | | - end |
196 | | - end |
197 | 112 | end |
0 commit comments