Skip to content

Instantly share code, notes, and snippets.

@DaveSanders
Last active August 10, 2023 19:47
Show Gist options
  • Select an option

  • Save DaveSanders/2eefc4de3e085d38fd6901da7dd47712 to your computer and use it in GitHub Desktop.

Select an option

Save DaveSanders/2eefc4de3e085d38fd6901da7dd47712 to your computer and use it in GitHub Desktop.

Revisions

  1. DaveSanders revised this gist Nov 11, 2020. 1 changed file with 22 additions and 3 deletions.
    25 changes: 22 additions & 3 deletions sr_rspec_notes.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,30 @@
    Scenario:
    I want to use Rspec to build feature specs that test SR pages, just like normal web pages
    ## Scenario
    I want to use Rspec to build feature specs that test SR pages, just like normal web pages.

    Therefore, I expect Capybara + Rspec to be able to do things like:

    ```
    visit login_path
    fill_in 'Email', with: user.email
    fill_in 'Password', with: user.password + 'BAD'

    expect(page).to have_content('That email or password is not correct')
    ```

    ## Setup
    After installing gems, setting up redis, etc. I wrote my first non-SR test, which worked, but outputted the following to the console, cluttering my rspec window:

    ```
    WARNING: Stimulus Reflex requires caching to be enabled. Caching allows the session to be modified during ActionCable requests.
    To enable caching in development, run:
    rails dev:cache
    ```

    To fix, I edited two lines in test.rb:
    ```
    config.action_controller.perform_caching = true
    config.cache_store = :memory_store
    ```

    Which made the error go away and let me run my spec.


  2. DaveSanders created this gist Nov 11, 2020.
    11 changes: 11 additions & 0 deletions sr_rspec_notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    Scenario:
    I want to use Rspec to build feature specs that test SR pages, just like normal web pages
    Therefore, I expect Capybara + Rspec to be able to do things like:

    visit login_path
    fill_in 'Email', with: user.email
    fill_in 'Password', with: user.password + 'BAD'

    expect(page).to have_content('That email or password is not correct')