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

- The `have_text` matcher works fine.
This commit is contained in:
Timothy Andrew 2016-06-03 08:58:15 +05:30
parent 4d50d8a6e3
commit a1295d8ebe

View file

@ -4,15 +4,15 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
let(:user) { create(:user) }
def active_personal_access_tokens
find(".table.active-personal-access-tokens").native['innerHTML']
find(".table.active-personal-access-tokens")
end
def inactive_personal_access_tokens
find(".table.inactive-personal-access-tokens").native['innerHTML']
find(".table.inactive-personal-access-tokens")
end
def created_personal_access_token
find(".created-personal-access-token pre").native['innerHTML']
find(".created-personal-access-token pre")
end
before do
@ -25,9 +25,9 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
fill_in "Name", with: FFaker::Product.brand
expect {click_on "Add Personal Access Token"}.to change { PersonalAccessToken.count }.by(1)
expect(created_personal_access_token).to eq(PersonalAccessToken.last.token)
expect(active_personal_access_tokens).to match(PersonalAccessToken.last.name)
expect(active_personal_access_tokens).to match("Never")
expect(created_personal_access_token).to have_text(PersonalAccessToken.last.token)
expect(active_personal_access_tokens).to have_text(PersonalAccessToken.last.name)
expect(active_personal_access_tokens).to have_text("Never")
end
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
click_on "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(active_personal_access_tokens).to match(PersonalAccessToken.last.name)
expect(active_personal_access_tokens).to match(Date.today.next_month.at_beginning_of_month.to_s(:medium))
expect(created_personal_access_token).to have_text(PersonalAccessToken.last.token)
expect(active_personal_access_tokens).to have_text(PersonalAccessToken.last.name)
expect(active_personal_access_tokens).to have_text(Date.today.next_month.at_beginning_of_month.to_s(:medium))
end
end
@ -51,14 +51,14 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
visit profile_personal_access_tokens_path
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
it "moves expired tokens to the 'inactive' section" do
personal_access_token = create(:personal_access_token, expires_at: 5.days.ago, user: user)
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