24 lines
837 B
Ruby
24 lines
837 B
Ruby
require "rails_helper"
|
|
|
|
vcr_option = {
|
|
cassette_name: "github_issue_api",
|
|
allow_playback_repeats: "true",
|
|
}
|
|
|
|
RSpec.describe GithubIssue, type: :model, vcr: vcr_option do
|
|
let(:link) { "https://api.github.com/repos/thepracticaldev/dev.to/issues/9#issue-195721413" }
|
|
|
|
before do
|
|
allow(described_class).to receive(:get_html).and_return("<p><code>Dev.to</code> looks awesome.")
|
|
end
|
|
|
|
it "finds or fetches based on URL" do
|
|
# NB: this approvals test is a little harder to update
|
|
# because a legitimate github access token is required for octokit
|
|
# which is then captured via vcr.
|
|
# IF YOU DO PLAN TO UPDATE THIS: be sure to remove your access token
|
|
# from the vcr cassette generated by this
|
|
issue = described_class.find_or_fetch(link)
|
|
expect(issue.processed_html).to include("looks awesome")
|
|
end
|
|
end
|