@@ -159,6 +159,9 @@ def setup
159
159
@jane . current_team . visitors . create ( email :
"[email protected] " , first_name :
"Liam" , last_name :
"Patel" )
160
160
@jane . current_team . visitors . create ( email :
"[email protected] " , first_name :
"Ava" , last_name :
"Brown" )
161
161
@jane . current_team . visitors . create ( email :
"[email protected] " , first_name :
"Ethan" , last_name :
"Kim" )
162
+ 250 . times do
163
+ @jane . current_team . visitors . create ( email : "random+#{ SecureRandom . uuid } @example.com" , first_name : SecureRandom . hex . first ( 5 ) , last_name : SecureRandom . hex . first ( 5 ) )
164
+ end
162
165
163
166
login_as ( @jane , scope : :user )
164
167
visit account_team_path ( @jane . current_team )
@@ -179,10 +182,18 @@ def setup
179
182
csv_export_action = Visitors ::CsvExportAction . order ( :id ) . last
180
183
csv_data = csv_export_action . file . download
181
184
182
- assert_match ( /id,email,first_name,last_name/ , csv_data )
183
- assert_match ( /[email protected] ,Liam,Patel/ , csv_data )
185
+ # Ensure the header is in the right spot.
186
+ assert_match ( /id,email,first_name,last_name/ , csv_data . lines . first )
187
+
188
+ # Ensure the first record is where we expect it.
189
+ assert_match ( /[email protected] ,Liam,Patel/ , csv_data . lines [ 1 ] )
190
+
191
+ # Ensure the other records are in the CSV.
184
192
assert_match ( /[email protected] ,Ava,Brown/ , csv_data )
185
193
assert_match ( /[email protected] ,Ethan,Kim/ , csv_data )
194
+
195
+ # Ensure all records and headers were exported.
196
+ assert_equal csv_data . lines . count , 254
186
197
end
187
198
end
188
199
end
0 commit comments