I hereby claim:
- I am ross-hunter on github.
- I am rosshunter (https://keybase.io/rosshunter) on keybase.
- I have a public key ASBO_f8n8vDlPUoW7QSPIbfdMdhvmwZLi0e1OE-UGxAQ-go
To claim this, I am signing this object:
| # We mix this in to our controllers | |
| module Authenticatable | |
| extend ActiveSupport::Concern | |
| included do | |
| before_action :authenticate_user! | |
| end | |
| protected |
I hereby claim:
To claim this, I am signing this object:
Who am I? http://ross-hunter.com/
What is JSON API? http://jsonapi.org/format/
What is JSONAPI::Resources http://jsonapi-resources.com/
What is jsonapi_expectations
| module RequestSpecHelpers | |
| def authenticate user | |
| params = { email: user.email, password: 'test_password' } | |
| post api_v2_auth_path, params: params | |
| # You will need to modify this line based on your auth scheme | |
| # This code works with token based auth | |
| @auth_token = json_body.dig :meta, :'auth-token' | |
| end |
| // ** Mad Libs ** | |
| // Ask the user for the words to fill in the blanks | |
| var who = prompt("a person"); | |
| var what = prompt("a thing"); | |
| var amount = prompt("a number"); | |
| // prompt always returns a string. here we convert it to a number | |
| amount = Number(amount); | |
| // calculate the total | |
| var total = amount * 5; |
| <html> | |
| <style> | |
| /* RESET CSS */ | |
| ul { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| li { | |
| margin: 0; | |
| padding: 0; |
| <html> | |
| <style> | |
| .flex-container { | |
| display: flex; | |
| align-items: baseline; | |
| justify-content: space-between; | |
| } | |
| .top-nav { | |
| background-color: #551A8B; | |
| color: rgba(255,255,255,0.8); |
| [include] | |
| path = ~/.gitconfig-core | |
| path = ~/.gitconfig-aliases | |
| [user] | |
| name = | |
| email = | |
| [alias] | |
| pr = !zsh -ic open-pr | |
| [core] | |
| autocrlf = input |
| module HttpHelpers | |
| def authenticate user | |
| params = { email: user.email, password: 'test_password' } | |
| post '/auth', params | |
| @auth_token = json_body.dig :meta, :'auth-token' | |
| end | |
| def authed_get endpoint, opts = {} | |
| get endpoint, opts, auth_header |
| module ExpectationHelpers | |
| def expect_attributes attrs | |
| expect_json 'data.attributes', dasherize_keys(attrs) | |
| end | |
| def expect_attributes_in_list attrs | |
| expect(json_body[:data]).to_not be_empty | |
| expect_json 'data.?.attributes', dasherize_keys(attrs) | |
| end |