Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed RSpec UI/API setup and testing #37

Merged
merged 7 commits into from
Feb 21, 2025
Merged

Fixed RSpec UI/API setup and testing #37

merged 7 commits into from
Feb 21, 2025

Conversation

bkuhlmann
Copy link
Member

Overview

Necessary to make writing UI and/or API specs much easier by using Capybara for the former and Rack for the the latter. This has the added benefit of bringing clarity to the specs so you can use visit or simple Rack HTTP verb methods. Chromium is wired up for headless testing to make all of this simple to use.

Details

  • See commits for details.

Necessary to ensure the headless Chromium driver is available for testing purposes.
Necessary to improve our test suite since not having Cabybara's DSL makes things too cumbersome. By adding these gems we'll be able to clean up our Sinatra (web) specific specs. Documentation:

* link:https://github.com/teamcapybara/capybara[Capybara]
* link:https://cuprite.rubycdp.com[Cuprite]
* link:https://rubygems.org/gems/launchy[Launchy]

We no longer need to require Ferrum because Cuprite is built upon it.
Necessary to parsing API repsonses. This in a `sinatra` folder to ensure there is a distinction between pure Ruby and Sinatra contexts.
Necessary to have a helper for pure Ruby code (i.e. `spec_helper.rb`) and another helper for for the web framework (i.e. `sinatra_helper.rb`). This mostly pulled from link:https://alchemists.io/projects/hanamismith[Hanamismith] but adapted for Sinatra.

This properly wires up Capybara so we can write spects that test the UI without having to spend so much time digging into the HTML DOM. 🎉
Necessary to simplify writing Web UI specs. Duplicate specs were removed because they are identical to what's in the setup spec.
Necessary to clean up the specs further by clearly defining the subject and leveraging the API shared context for improved clarity and reduced duplication.
Necessary to clarify that this is a pure Ruby shared context (not to be confused with Sinatra) and is meant to be used by the `spec_helper.rb` only.
@bkuhlmann bkuhlmann merged commit a7cb1f7 into master Feb 21, 2025
0 of 2 checks passed
@bkuhlmann bkuhlmann deleted the cuprite branch February 21, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant