forked from SplitTime/OpenSplitTime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin implementing tests for Api::V2::CoursesController.
- Loading branch information
Showing
12 changed files
with
56 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
namespace: api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Register a payload to validate against. | ||
# Add expected attributes within this block, e.g.: | ||
# | ||
# key(:name) | ||
# | ||
# Optionally validate the type as well: | ||
# | ||
# key(:name, String) | ||
# | ||
# This will: | ||
# | ||
# * Compare record.name == json['name'] | ||
# * Ensure no extra keys are in the json payload | ||
# * Ensure no values are nil (unless allow_nil: true is passed) | ||
# * Ensures json['name'] is a string | ||
# | ||
# If you have custom serialization logic and want to compare against | ||
# something other than "record.name", pass a block: | ||
# | ||
# key(:name) { |record| record.name.upcase } | ||
# | ||
# Or, if this is a one-off for a particular spec, do that customization at | ||
# runtime: | ||
# | ||
# assert_payload(:person, person_record, json_item) do | ||
# key(:name) { 'Homer Simpson' } | ||
# end | ||
# | ||
# For more information, see https://jsonapi-suite.github.io/jsonapi_spec_helpers/ | ||
JsonapiSpecHelpers::Payload.register(:course) do | ||
key(:name, String) | ||
key(:description, String) | ||
key(:next_start_time, DateTime) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
RSpec.configure do |config| | ||
config.include JsonapiSpecHelpers, type: :request | ||
config.extend ControllerMacros, type: :request | ||
config.include Devise::Test::ControllerHelpers, type: :request | ||
end |