✨
Public Notes
  • Personal running notes using Forem
  • Setting up a local test env without docker
  • Setting gitbook to use "main" branch by default
  • User Moderation
    • User Moderation is really just scoring
  • Flaky Specs
    • GithubReadmeTag
    • JS Testing
    • Setup not completed
    • userData is sometimes not loaded
    • Tracking down spec failures
    • Flaky Specs #1
  • Travis CI Segfaults
  • Bookmarks
  • User Setup in development
  • Testing in Docker locally
    • Reapproach quay containers
    • Webdriver and chrome headless
      • Using Selenium standalone
      • Chrome in docker
    • Setting up a local test env with docker
    • Traditional CI container setup
  • Peer Review
  • Rails runaway process in initialize!
    • Don't fix it
    • fix it?
  • Zeitwerk
  • Parallelize Cypress
  • Reading List
  • Sidekiq Memory Use
  • Buildkite configuration
  • Dumping heap
  • Tricking KnapsackPro
  • Debugging Ruby
  • Docker development revisited
  • gitpod development test
  • Embedding HTML in Markdown
Powered by GitBook
On this page

Was this helpful?

  1. Flaky Specs

GithubReadmeTag

dynamic classes and verifying doubles are order dependent

The Github::OauthClient wraps another class (Octokit) and uses method_missing to define api access as needed. Unfortunately, this means instance methods, other than the overridden "inspect", are not defined until they're called - and rspec will fail if this is run out of order.


Randomized with seed 7704
[Zonebie] Setting timezone: ZONEBIE_TZ="Novosibirsk"

GithubTag::GithubReadmeTag
  #id
    renders a repository with a missing README (FAILED - 1)
    renders a repository URL with a trailing slash
    rejects invalid GitHub repository URL
    renders a repository path
    renders a repository URL with a fragment
    rejects GitHub URL without domain
    renders a repository path with a trailing slash
    renders a repository URL
    rejects a non existing GitHub repository URL
    options
      accepts 'no-readme' as an option
      rejects invalid options
    regressions
      parses a repository with invalid img tags

Failures:

  1) GithubTag::GithubReadmeTag#id renders a repository with a missing README
     Failure/Error: allow_any_instance_of(Github::OauthClient).to receive(:readme).and_raise(Github::Errors::NotFound) # rubocop:disable RSpec/AnyInstance                                                   
       Github::OauthClient does not implement #readme
     # ./spec/liquid_tags/github_tag/github_readme_tag_spec.rb:77:in `block (3 levels) in <top (required)>'  
     # ./spec/rails_helper.rb:125:in `block (2 levels) in <top (required)>'

Finished in 2.49 seconds (files took 2.77 seconds to load)
12 examples, 1 failure

Failed examples:

rspec ./spec/liquid_tags/github_tag/github_readme_tag_spec.rb:71 # GithubTag::GithubReadmeTag#id renders a repository with a missing README                              

A dirty solution would be to instantiate an oauth client, call readme, accept that it fails, and then execute the test. A "better" solution might be to have the client class list the known instance methods (we're using maybe 10) and pre-define them at load time.

PreviousFlaky SpecsNextJS Testing

Last updated 4 years ago

Was this helpful?

maybe something like this. Or what Rhymes did the first time

https://github.com/djuber/forem/commit/d414f7e55
https://github.com/forem/forem/commit/3130261384#diff-058371fd17700cbee2b084681a6515dc723daf206855881cbf8bb44d9774cab7R21-R27