|
5 | 5 | let(:source_form) { create(:form, :live_with_draft) } |
6 | 6 | let(:source_form_document) { FormDocument.find_by(form_id: source_form.id) } |
7 | 7 | let(:logged_in_user) { create(:user) } |
8 | | - let(:copied_form) { described_class.new(source_form, logged_in_user).copy(tag: "live") } |
| 8 | + let(:tag) { "live" } |
| 9 | + let(:copied_form) { described_class.new(source_form, logged_in_user).copy(tag:) } |
9 | 10 |
|
10 | 11 | before do |
11 | 12 | GroupForm.create!(form: source_form, group: group) |
|
233 | 234 |
|
234 | 235 | context "when source form is in a group" do |
235 | 236 | let(:group) { create(:group) } |
236 | | - let(:source_form) { create(:form, :live_with_draft) } |
237 | 237 |
|
238 | | - it "places the copied form in the same group as the original form" do |
239 | | - expect(copied_form.group).to eq(source_form.group) |
240 | | - expect(copied_form.group).to eq(group) |
| 238 | + context "when copying a live form" do |
| 239 | + let(:source_form) { create(:form, :live_with_draft) } |
| 240 | + |
| 241 | + it "places the copied form in the same group as the original form" do |
| 242 | + expect(copied_form.group).to eq(source_form.group) |
| 243 | + expect(copied_form.group).to eq(group) |
| 244 | + end |
| 245 | + end |
| 246 | + |
| 247 | + context "when copying a draft form with no pages" do |
| 248 | + let(:source_form) { create(:form) } |
| 249 | + let(:tag) { "draft" } |
| 250 | + |
| 251 | + it "places the copied form in the same group as the original form" do |
| 252 | + expect(copied_form.group).to eq(source_form.group) |
| 253 | + expect(copied_form.group).to eq(group) |
| 254 | + end |
241 | 255 | end |
242 | 256 | end |
243 | 257 |
|
|
0 commit comments