Skip to content

Commit a29878a

Browse files
committed
changed order of expectation
1 parent f42b200 commit a29878a

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

spec/usage/components/action_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def action_config
6161

6262
visit "/example"
6363

64-
click_button "Click me!"
65-
6664
expect_any_instance_of(ActionTestController).to receive(:expect_params)
6765
.with(hash_including(:foo => "bar"))
6866

67+
click_button "Click me!"
68+
6969
end
7070

7171
it "Example 2 - Async request with URL param" do
@@ -99,11 +99,11 @@ def action_config
9999

100100
visit "/example"
101101

102-
click_button "Click me!"
103-
104102
expect_any_instance_of(ActionTestController).to receive(:expect_params)
105103
.with(hash_including(:id => "42"))
106104

105+
click_button "Click me!"
106+
107107
end
108108

109109
describe "Success/Failure Behavior" do
@@ -560,11 +560,11 @@ def action_config
560560

561561
visit "/example"
562562

563-
click_button "Click me!"
564563

565564
expect_any_instance_of(ActionTestController).to receive(:expect_params)
566565
.with(hash_including(:id => "42"))
567566

567+
click_button "Click me!"
568568
end
569569

570570
# not working right now

spec/usage/components/form_spec.rb

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ def form_config
113113
visit "/example"
114114

115115
fill_in "my-test-input", with: "bar"
116-
click_button "Submit me!"
117116

118117
expect_any_instance_of(FormTestController).to receive(:expect_params)
119118
.with(hash_including(my_object: { foo: "bar" }))
120119

120+
click_button "Submit me!"
121+
121122
end
122123

123124
it "Example 2 - Async submit request and clears inputs on success" do
@@ -527,7 +528,7 @@ def form_config
527528
fill_in "password-input", with: "secret"
528529
fill_in "number-input", with: 123
529530
fill_in "textarea-input", with: "Hello \n World!"
530-
click_button "Submit me!"
531+
531532

532533
expect_any_instance_of(FormTestController).to receive(:expect_params)
533534
.with(hash_including(
@@ -540,6 +541,8 @@ def form_config
540541
}
541542
))
542543

544+
click_button "Submit me!"
545+
543546
end
544547

545548
end
@@ -782,11 +785,11 @@ def form_config
782785

783786
select "Array Option 2", from: "my-array-test-dropdown"
784787
select "Hash Option 2", from: "my-hash-test-dropdown"
785-
click_button "Submit me!"
786788

787789
expect_any_instance_of(FormTestController).to receive(:expect_params)
788790
.with(hash_including(my_object: { array_input: "Array Option 2", hash_input: "2" }))
789791

792+
click_button "Submit me!"
790793
end
791794

792795
it "can be initialized with value" do
@@ -825,11 +828,11 @@ def form_config
825828

826829
select "Array Option 2", from: "my-array-test-dropdown"
827830
select "Hash Option 2", from: "my-hash-test-dropdown"
828-
click_button "Submit me!"
829831

830832
expect_any_instance_of(FormTestController).to receive(:expect_params)
831833
.with(hash_including(my_object: { array_input: "Array Option 2", hash_input: "2" }))
832834

835+
click_button "Submit me!"
833836
end
834837

835838
it "can be mapped to an Active Record Model Array Enum" do
@@ -1064,11 +1067,12 @@ def form_config
10641067
check "Hash Option 1"
10651068
check "Hash Option 2"
10661069

1067-
click_button "Submit me!"
10681070

10691071
expect_any_instance_of(FormTestController).to receive(:expect_params)
10701072
.with(hash_including(my_object: { array_input: ["Array Option 2"], hash_input: ["1", "2"] }))
10711073

1074+
click_button "Submit me!"
1075+
10721076
end
10731077

10741078
it "can be initialized by (multiple) item(s)" do
@@ -1102,10 +1106,11 @@ def form_config
11021106

11031107
visit "/example"
11041108

1105-
click_button "Submit me!"
11061109

11071110
expect_any_instance_of(FormTestController).to receive(:expect_params)
11081111
.with(hash_including(my_object: { array_input: ["Array Option 1", "Array Option 2"], hash_input: ["2"] }))
1112+
1113+
click_button "Submit me!"
11091114

11101115
end
11111116

@@ -1231,11 +1236,11 @@ def form_config
12311236
choose('Array Option 2')
12321237
choose('Hash Option 1')
12331238

1234-
click_button "Submit me!"
12351239

12361240
expect_any_instance_of(FormTestController).to receive(:expect_params)
12371241
.with(hash_including(my_object: { array_input: "Array Option 2", hash_input: "1" }))
12381242

1243+
click_button "Submit me!"
12391244
end
12401245

12411246
it "can be initialized by (multiple) item(s)" do
@@ -1274,11 +1279,11 @@ def form_config
12741279
expect(page).to have_field('Hash Option 1', checked: false)
12751280
expect(page).to have_field('Hash Option 2', checked: true)
12761281

1277-
click_button "Submit me!"
12781282

12791283
expect_any_instance_of(FormTestController).to receive(:expect_params)
12801284
.with(hash_including(my_object: { array_input: "Array Option 1", hash_input: "2" }))
12811285

1286+
click_button "Submit me!"
12821287
end
12831288

12841289
it "can be mapped to an Active Record Model Array Enum" do
@@ -1606,11 +1611,11 @@ def response
16061611
visit "/example"
16071612

16081613
fill_in "my-test-input", with: "bar"
1609-
click_button "Submit me!"
16101614

16111615
expect_any_instance_of(FormTestController).to receive(:expect_params)
16121616
.with(hash_including(my_object: { foo: "bar" }))
16131617

1618+
click_button "Submit me!"
16141619
end
16151620
end
16161621

0 commit comments

Comments
 (0)