Skip to content
This repository has been archived by the owner on Nov 6, 2021. It is now read-only.

RSpec Hero 3: Legends of RSpec #51

Closed
40 tasks
armahillo opened this issue Nov 18, 2018 · 3 comments
Closed
40 tasks

RSpec Hero 3: Legends of RSpec #51

armahillo opened this issue Nov 18, 2018 · 3 comments

Comments

@armahillo
Copy link
Collaborator

Expand the RSpec suite.

Push up a PR mentioning (but not closing / fixing, unless it really does finish the issue) this issue, then check off the ones you've done.

Configuration

  • Remove explicit references to FactoryBot (eg. FactoryBot.build(...))
  • Replace --require spec_helper with --require rails_helper in /.rspec

Models

partner_request_spec.rb

  • it disallows an item attribute if the quantity isn't set
  • "make name required" is actually checking "email" field (tweak example title)
  • it has a proof of partner status attachment
  • it has a proof of form 990 attachment
  • it can have one or more documents attached
  • approve_me changes the partner_status
  • approve_me posts to the target DiaperBank (will need to stub the request)

Services

diaper_bank_client_spec.rb

These need additional tests, but it will be hard to test them without the guard clause stopping non-Prod

  • post_request prepares a Post object
  • post_request sets the X-Api-Key

Controllers

The "requires authentication" specs can probably be a shared example.

partner_requests_controller_spec.rb

  • :index is invalid without authentication
  • :new is invalid without authentication
  • :create is invalid without authentication
  • :show is invalid without authentication

api_controller_spec.rb

Should this be marked as an abstract class?

partners_controller_spec.rb

  • :index is invalid without authentication

  • :new is invalid without authentication

  • :create is invalid without authentication

  • :show is invalid without authentication

  • :edit is invalid without authentication

  • :update is invalid without authentication

  • :approve is invalid without authentication

  • :destroy is invalid without authentication

  • :index is successful

  • :show is successful

  • :new is successful

  • :edit is successful

  • :approve is successful (be sure to stub the post from DiaperBankClient)

  • :create is successful via HTML

  • :create is successful via JSON

  • :update is successful via HTML

  • :update is successful via JSON

static_controller_spec.rb

  • :index is successful
  • :page is successful (you'll have to get creative with this one)

API

partners_controller_spec.rb

  • :create returns :forbidden if the API key is invalid
  • :create is successful
  • :update returns :forbidden if the API key is invalid
  • :update is successful
  • :show returns :forbidden if the API key is invalid
  • :show is successful

Features

TBA

@chaserx
Copy link
Collaborator

chaserx commented Mar 5, 2019

@armahillo I wonder how many of these tasks we've completed with the referenced PRs?

@NiquiCara
Copy link
Contributor

I'm at Ruby by the Bay, and just completed an audit of this issue by looking at the current code. Here's what still needs to be done:

Services

diaper_bank_client_spec.rb

These need additional tests, but it will be hard to test them without the guard clause stopping non-Prod

  • post_request sets the X-Api-Key

Controllers

partners_controller_spec.rb

(Note: html specs seem implemented; but not Json)

  • :create is successful via HTML
  • :create is successful via JSON
  • :update is successful via HTML
  • :update is successful via JSON

API

partners_controller_spec.rb

(note: not sure if implemented.. perhaps in spec/requests/api/v1/partners_requests_spec.rb ???)

  • :create returns :forbidden if the API key is invalid
  • :create is successful
  • :update returns :forbidden if the API key is invalid
  • :update is successful
  • :show returns :forbidden if the API key is invalid
  • :show is successful

@NiquiCara
Copy link
Contributor

Recommend closing this issue in favor of issues #97, #98, and #99.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants