Commit a1295d8e authored by Timothy Andrew's avatar Timothy Andrew

Don't use `natve['innerHTML']` in the feature spec.

- The `have_text` matcher works fine.
parent 4d50d8a6
...@@ -4,15 +4,15 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do ...@@ -4,15 +4,15 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
def active_personal_access_tokens def active_personal_access_tokens
find(".table.active-personal-access-tokens").native['innerHTML'] find(".table.active-personal-access-tokens")
end end
def inactive_personal_access_tokens def inactive_personal_access_tokens
find(".table.inactive-personal-access-tokens").native['innerHTML'] find(".table.inactive-personal-access-tokens")
end end
def created_personal_access_token def created_personal_access_token
find(".created-personal-access-token pre").native['innerHTML'] find(".created-personal-access-token pre")
end end
before do before do
...@@ -25,9 +25,9 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do ...@@ -25,9 +25,9 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
fill_in "Name", with: FFaker::Product.brand fill_in "Name", with: FFaker::Product.brand
expect {click_on "Add Personal Access Token"}.to change { PersonalAccessToken.count }.by(1) expect {click_on "Add Personal Access Token"}.to change { PersonalAccessToken.count }.by(1)
expect(created_personal_access_token).to eq(PersonalAccessToken.last.token) expect(created_personal_access_token).to have_text(PersonalAccessToken.last.token)
expect(active_personal_access_tokens).to match(PersonalAccessToken.last.name) expect(active_personal_access_tokens).to have_text(PersonalAccessToken.last.name)
expect(active_personal_access_tokens).to match("Never") expect(active_personal_access_tokens).to have_text("Never")
end end
it "allows creation of a token with an expiry date" do it "allows creation of a token with an expiry date" do
...@@ -39,9 +39,9 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do ...@@ -39,9 +39,9 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
click_on "1" click_on "1"
expect {click_on "Add Personal Access Token"}.to change { PersonalAccessToken.count }.by(1) expect {click_on "Add Personal Access Token"}.to change { PersonalAccessToken.count }.by(1)
expect(created_personal_access_token).to eq(PersonalAccessToken.last.token) expect(created_personal_access_token).to have_text(PersonalAccessToken.last.token)
expect(active_personal_access_tokens).to match(PersonalAccessToken.last.name) expect(active_personal_access_tokens).to have_text(PersonalAccessToken.last.name)
expect(active_personal_access_tokens).to match(Date.today.next_month.at_beginning_of_month.to_s(:medium)) expect(active_personal_access_tokens).to have_text(Date.today.next_month.at_beginning_of_month.to_s(:medium))
end end
end end
...@@ -51,14 +51,14 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do ...@@ -51,14 +51,14 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
visit profile_personal_access_tokens_path visit profile_personal_access_tokens_path
click_on "Revoke" click_on "Revoke"
expect(inactive_personal_access_tokens).to match(personal_access_token.name) expect(inactive_personal_access_tokens).to have_text(personal_access_token.name)
end end
it "moves expired tokens to the 'inactive' section" do it "moves expired tokens to the 'inactive' section" do
personal_access_token = create(:personal_access_token, expires_at: 5.days.ago, user: user) personal_access_token = create(:personal_access_token, expires_at: 5.days.ago, user: user)
visit profile_personal_access_tokens_path visit profile_personal_access_tokens_path
expect(inactive_personal_access_tokens).to match(personal_access_token.name) expect(inactive_personal_access_tokens).to have_text(personal_access_token.name)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment