Skip to content

Commit 07e3dc2

Browse files
committed
Standardize on assert_text over assert_content (they're the same).
Just so we don't have a mix of different usage in different places, let's try to standardize on one of the method names. Same for refute_text over refute_content.
1 parent e9bb719 commit 07e3dc2

16 files changed

+79
-79
lines changed

test/admin_ui/test_admins.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ def test_superuser_checkbox_as_superuser_admin
1414
admin_login
1515
visit "/admin/#/admins/new"
1616

17-
assert_content("Username")
18-
assert_content("Superuser")
17+
assert_text("Username")
18+
assert_text("Superuser")
1919
end
2020

2121
def test_superuser_checkbox_as_limited_admin
2222
admin_login(FactoryGirl.create(:limited_admin))
2323
visit "/admin/#/admins/new"
2424

25-
assert_content("Username")
26-
refute_content("Superuser")
25+
assert_text("Username")
26+
refute_text("Superuser")
2727
end
2828

2929
def test_adds_groups_when_checked
@@ -43,7 +43,7 @@ def test_adds_groups_when_checked
4343

4444
click_button("Save")
4545

46-
assert_content("Successfully saved the admin")
46+
assert_text("Successfully saved the admin")
4747

4848
admin = Admin.find(admin.id)
4949
assert_equal([@group1.id, @group3.id].sort, admin.group_ids.sort)
@@ -67,7 +67,7 @@ def test_removes_groups_when_checked
6767

6868
click_button("Save")
6969

70-
assert_content("Successfully saved the admin")
70+
assert_text("Successfully saved the admin")
7171

7272
admin = Admin.find(admin.id)
7373
assert_equal([@group3.id].sort, admin.group_ids.sort)

test/admin_ui/test_api_users.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_form
4343
select "Disabled", :from => "Account Enabled"
4444

4545
click_button("Save")
46-
assert_content("Successfully saved")
46+
assert_text("Successfully saved")
4747

4848
user = ApiUser.desc(:created_at).first
4949
visit "/admin/#/api_users/#{user.id}/edit"

test/admin_ui/test_api_users_allowed_ips.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_empty_input_saves_as_null
2020
check "User agrees to the terms and conditions"
2121
click_button("Save")
2222

23-
assert_content("Successfully saved the user")
23+
assert_text("Successfully saved the user")
2424
user = ApiUser.order_by(:created_at.asc).last
2525
assert_nil(user["settings"]["allowed_ips"])
2626
end
@@ -36,7 +36,7 @@ def test_multiple_lines_saves_as_array
3636
fill_in "Restrict Access to IPs", :with => "10.0.0.0/8\n\n\n\n127.0.0.1"
3737
click_button("Save")
3838

39-
assert_content("Successfully saved the user")
39+
assert_text("Successfully saved the user")
4040
user = ApiUser.order_by(:created_at.asc).last
4141
assert_equal(["10.0.0.0/8", "127.0.0.1"], user["settings"]["allowed_ips"])
4242
end
@@ -58,7 +58,7 @@ def test_nullifies_existing_array_when_empty_input_saved
5858
fill_in "Restrict Access to IPs", :with => ""
5959
click_button("Save")
6060

61-
assert_content("Successfully saved the user")
61+
assert_text("Successfully saved the user")
6262
user.reload
6363
assert_nil(user["settings"]["allowed_ips"])
6464
end

test/admin_ui/test_api_users_allowed_referers.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_empty_input_saves_as_null
2020
check "User agrees to the terms and conditions"
2121
click_button("Save")
2222

23-
assert_content("Successfully saved the user")
23+
assert_text("Successfully saved the user")
2424
user = ApiUser.order_by(:created_at.asc).last
2525
assert_nil(user["settings"]["allowed_referers"])
2626
end
@@ -36,7 +36,7 @@ def test_multiple_lines_saves_as_array
3636
fill_in "Restrict Access to HTTP Referers", :with => "*.example.com/*\n\n\n\nhttp://google.com/*"
3737
click_button("Save")
3838

39-
assert_content("Successfully saved the user")
39+
assert_text("Successfully saved the user")
4040
user = ApiUser.order_by(:created_at.asc).last
4141
assert_equal(["*.example.com/*", "http://google.com/*"], user["settings"]["allowed_referers"])
4242
end
@@ -58,7 +58,7 @@ def test_nullifies_existing_array_when_empty_input_saved
5858
fill_in "Restrict Access to HTTP Referers", :with => ""
5959
click_button("Save")
6060

61-
assert_content("Successfully saved the user")
61+
assert_text("Successfully saved the user")
6262
user.reload
6363
assert_nil(user["settings"]["allowed_referers"])
6464
end

test/admin_ui/test_api_users_api_key_visibility.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ def test_api_key_in_create_notification
2121
check "User agrees to the terms and conditions"
2222
click_button("Save")
2323

24-
assert_content("Successfully saved the user")
24+
assert_text("Successfully saved the user")
2525
user = ApiUser.order_by(:created_at.asc).last
2626
assert_equal("Doe", user.last_name)
27-
assert_content(user.api_key)
27+
assert_text(user.api_key)
2828
end
2929

3030
def test_api_key_can_be_revealed_when_admin_has_permissions
@@ -33,17 +33,17 @@ def test_api_key_can_be_revealed_when_admin_has_permissions
3333
admin_login(admin)
3434
visit "/admin/#/api_users/#{user.id}/edit"
3535

36-
assert_content(user.api_key_preview)
37-
refute_content(user.api_key)
36+
assert_text(user.api_key_preview)
37+
refute_text(user.api_key)
3838
assert_link("(reveal)")
3939
click_link("(reveal)")
40-
assert_content(user.api_key)
41-
refute_content(user.api_key_preview)
40+
assert_text(user.api_key)
41+
refute_text(user.api_key_preview)
4242
refute_link("(reveal)")
4343
assert_link("(hide)")
4444
click_link("(hide)")
45-
assert_content(user.api_key_preview)
46-
refute_content(user.api_key)
45+
assert_text(user.api_key_preview)
46+
refute_text(user.api_key)
4747
assert_link("(reveal)")
4848
end
4949

@@ -53,8 +53,8 @@ def test_api_key_is_hidden_when_admin_lacks_permissions
5353
admin_login(admin)
5454
visit "/admin/#/api_users/#{user.id}/edit"
5555

56-
assert_content(user.api_key_preview)
57-
refute_content(user.api_key)
56+
assert_text(user.api_key_preview)
57+
refute_text(user.api_key)
5858
refute_link("(reveal)")
5959
end
6060
end

test/admin_ui/test_api_users_rate_limits.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_edit_custom_rate_limits
2626
end
2727

2828
click_button("Save")
29-
assert_content("Successfully saved")
29+
assert_text("Successfully saved")
3030

3131
user.reload
3232

@@ -56,7 +56,7 @@ def test_remove_custom_rate_limits
5656
click_button("OK")
5757

5858
click_button("Save")
59-
assert_content("Successfully saved")
59+
assert_text("Successfully saved")
6060

6161
user.reload
6262

test/admin_ui/test_api_users_welcome_email.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_no_email_by_default
2323
fill_in "Last Name", :with => "Doe"
2424
check "User agrees to the terms and conditions"
2525
click_button("Save")
26-
assert_content("Successfully saved the user")
26+
assert_text("Successfully saved the user")
2727

2828
assert_equal(0, delayed_job_sent_messages.length)
2929
end
@@ -38,7 +38,7 @@ def test_email_when_explicitly_requested
3838
check "User agrees to the terms and conditions"
3939
check "Send user welcome e-mail with API key information"
4040
click_button("Save")
41-
assert_content("Successfully saved the user")
41+
assert_text("Successfully saved the user")
4242

4343
assert_equal(1, delayed_job_sent_messages.length)
4444
end

test/admin_ui/test_api_users_xss.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def test_xss_escaping_in_table
1515
admin_login
1616
visit "/admin/#/api_users"
1717

18-
assert_content(@user.email)
19-
assert_content(@user.first_name)
20-
assert_content(@user.last_name)
21-
assert_content(@user.use_description)
22-
assert_content(@user.registration_source)
18+
assert_text(@user.email)
19+
assert_text(@user.first_name)
20+
assert_text(@user.last_name)
21+
assert_text(@user.use_description)
22+
assert_text(@user.registration_source)
2323
refute_selector(".xss-test", :visible => :all)
2424
end
2525

@@ -32,7 +32,7 @@ def test_xss_escaping_in_form
3232
assert_equal(@user.first_name, find_field("First Name").value)
3333
assert_equal(@user.last_name, find_field("Last Name").value)
3434
assert_equal(@user.use_description, find_field("Purpose").value)
35-
assert_content(@user.registration_source)
35+
assert_text(@user.registration_source)
3636
refute_selector(".xss-test", :visible => :all)
3737
end
3838

@@ -44,7 +44,7 @@ def test_xss_escaping_in_flash_confirmation_message
4444
fill_in "Last Name", :with => "Doe"
4545
click_button("Save")
4646

47-
assert_content("Successfully saved the user \"#{@user.email}\"")
47+
assert_text("Successfully saved the user \"#{@user.email}\"")
4848
refute_selector(".xss-test", :visible => :all)
4949
end
5050
end

test/admin_ui/test_apis.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_saves_when_only_nested_fields_change
2626
fill_in "API Key Missing", :with => "hello1: foo\nhello2: bar", :visible => :all
2727

2828
click_button("Save")
29-
assert_content("Successfully saved")
29+
assert_text("Successfully saved")
3030

3131
api = Api.find(api.id)
3232
assert_equal({
@@ -41,14 +41,14 @@ def test_loads_from_server_on_each_load
4141
api = FactoryGirl.create(:api_with_settings, :name => "Test Load API", :frontend_host => "example1.com")
4242
admin_login
4343
visit "/admin/#/apis"
44-
assert_content("Add API Backend")
44+
assert_text("Add API Backend")
4545

4646
click_link "Test Load API"
4747
assert_equal("example1.com", find_field("Frontend Host").value)
4848

4949
find("nav a", :text => /Configuration/).click
5050
find("nav a", :text => /API Backends/).click
51-
assert_content("Add API Backend")
51+
assert_text("Add API Backend")
5252

5353
api.frontend_host = "example2.com"
5454
api.save!
@@ -64,7 +64,7 @@ def test_validation_error_when_all_servers_removed_from_existing_api
6464
find("#servers_table a", :text => /Remove/).click
6565
click_button("OK")
6666
click_button("Save")
67-
assert_content("Must have at least one servers")
67+
assert_text("Must have at least one servers")
6868

6969
api = Api.find(api.id)
7070
assert_equal(1, api.servers.length)
@@ -77,7 +77,7 @@ def test_validation_error_when_all_url_prefixes_removed_from_existing_api
7777
find("#url_matches_table a", :text => /Remove/).click
7878
click_button("OK")
7979
click_button("Save")
80-
assert_content("Must have at least one url_matches")
80+
assert_text("Must have at least one url_matches")
8181

8282
api = Api.find(api.id)
8383
assert_equal(1, api.url_matches.length)
@@ -223,7 +223,7 @@ def test_form
223223
fill_in "HTTPS Required", :with => "foo6: bar6\nbar6: foo6", :visible => :all
224224

225225
click_button("Save")
226-
assert_content("Successfully saved")
226+
assert_text("Successfully saved")
227227

228228
api = Api.desc(:created_at).first
229229
visit "/admin/#/apis/#{api.id}/edit"
@@ -369,7 +369,7 @@ def test_edit_custom_rate_limits
369369
end
370370

371371
click_button("Save")
372-
assert_content("Successfully saved")
372+
assert_text("Successfully saved")
373373

374374
api.reload
375375

@@ -397,13 +397,13 @@ def test_nested_select_menu_behavior_inside_modals
397397
within("#sub_settings_table") do
398398
# "any" for the HTTP Method should be shown despite not being explicitly
399399
# selected (since it's the default/first option).
400-
assert_content("any")
401-
assert_content("^/foo.*")
400+
assert_text("any")
401+
assert_text("^/foo.*")
402402
end
403403

404404
# Save the API.
405405
click_button("Save")
406-
assert_content("Successfully saved")
406+
assert_text("Successfully saved")
407407

408408
# Edit again.
409409
click_link api.name
@@ -412,8 +412,8 @@ def test_nested_select_menu_behavior_inside_modals
412412
find("legend a", :text => /Sub-URL Request Settings/).click
413413
assert_selector("#sub_settings_table")
414414
within("#sub_settings_table") do
415-
assert_content("any")
416-
assert_content("^/foo.*")
415+
assert_text("any")
416+
assert_text("^/foo.*")
417417
end
418418

419419
# Verify the sub-url setting in the modal and make explicit change the HTTP
@@ -429,13 +429,13 @@ def test_nested_select_menu_behavior_inside_modals
429429
end
430430
assert_selector("#sub_settings_table")
431431
within("#sub_settings_table") do
432-
assert_content("OPTIONS")
433-
assert_content("^/foo.*")
432+
assert_text("OPTIONS")
433+
assert_text("^/foo.*")
434434
end
435435

436436
# Save the API.
437437
click_button("Save")
438-
assert_content("Successfully saved")
438+
assert_text("Successfully saved")
439439

440440
# Edit again.
441441
click_link api.name
@@ -446,8 +446,8 @@ def test_nested_select_menu_behavior_inside_modals
446446
find("legend a", :text => /Sub-URL Request Settings/).click
447447
assert_selector("#sub_settings_table")
448448
within("#sub_settings_table") do
449-
assert_content("OPTIONS")
450-
assert_content("^/foo.*")
449+
assert_text("OPTIONS")
450+
assert_text("^/foo.*")
451451
end
452452
find("#sub_settings_table a", :text => /Edit/).click
453453
assert_selector(".modal")

test/admin_ui/test_config_publish_pending.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_refreshes_changes_on_load
9898

9999
find("nav a", :text => /Configuration/).click
100100
find("nav a", :text => /API Backends/).click
101-
assert_content("Add API Backend")
101+
assert_text("Add API Backend")
102102

103103
FactoryGirl.create(:api)
104104
find("nav a", :text => /Configuration/).click

0 commit comments

Comments
 (0)