Created
July 17, 2020 18:57
-
-
Save lucasmartins1994/66c502f9a09593456e22e80494b45587 to your computer and use it in GitHub Desktop.
Snippet for rspec acceptance
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
{ | |
"rspecAcceptance": { | |
"scope": "ruby", | |
"prefix": "rspecAcceptance", | |
"body": [ | |
"# frozen_string_literal: true", | |
"", | |
"require('acceptance_helper')", | |
"", | |
"resource '$1' do # rubocop:disable Metrics/BlockLength", | |
" header 'Accept', 'application/json'", | |
" header 'Content-Type', 'application/json'", | |
" header 'Host', 'example.com'", | |
"", | |
" let(:api_token_tdg) { create(:api_token).token }", | |
"", | |
" let(:$2_schema) do", | |
" %w[$3]", | |
" end", | |
"", | |
" # INDEX", | |
" get '$4' do # rubocop:disable Metrics/BlockLength", | |
" context 'with valid params' do", | |
" before { header 'TDG-Token', api_token }", | |
"", | |
" example_request '[GET] Return with all params' do", | |
" explanation '$5'", | |
" expect(status).to(eq(200))", | |
" body = JSON(response_body)", | |
" expect(body.count).to(eq(10))", | |
" expect(body.first.keys).to(match_array(article_schema))", | |
" end", | |
" end", | |
" end", | |
" end", | |
"end", | |
], | |
"description": "test for Acceptance" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment