Skip to content

Instantly share code, notes, and snippets.

View panSarin's full-sized avatar

Adam Piotrowski panSarin

View GitHub Profile
# frozen_string_literal: true
module Visits
class Create
include BaseService
def initialize(patient:, visit_params:)
@patient = patient
@visit_params = visit_params
end
@panSarin
panSarin / create.rb
Created February 16, 2022 12:45
services/visits/create.rb
# frozen_string_literal: true
require 'rails_helper'
describe Visits::Create do
subject { described_class.new(params).call }
let_it_be(:doctor) { create :user }
let_it_be(:patient) { create :user }
let_it_be(:slot) { create :slot, user: doctor, date: Time.current }
@panSarin
panSarin / test.rb
Created August 26, 2021 14:49
base64 w tescie
let_it_be(:variables) {
{
content:
'data:application/pdf;base64,JVBERi0xLjMKJf////8KOCAwIG9iago8PAovVHlwZSAvRXh0R1N0YXRlCi9jYSAxCj4+CmVuZG9iago2IDAgb2JqCjw8Ci9UeXBlIC9QYWdlCi9QYXJlbnQgMiAwIFIKL01lZGlhQm94IFswIDAgNTk1LjI4IDg0MS44OV0KL0NvbnRlbnRzIDQgMCBSCi9SZXNvdXJjZXMgNSAwIFIKPj4KZW5kb2JqCjUgMCBvYmoKPDwKL1Byb2NTZXQgWy9QREYgL1RleHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUldCi9YT2JqZWN0IDw8Ci9JMSA3IDAgUgo+PgovRXh0R1N0YXRlIDw8Ci9HczEgOCAwIFIKPj4KL0ZvbnQgPDwKL0YyIDkgMCBSCi9GNCAxMCAwIFIKL0YxMiAxMSAwIFIKPj4KPj4KZW5kb2JqCjE0IDAgb2JqCjw8Ci9UeXBlIC9QYWdlCi9QYXJlbnQgMiAwIFIKL01lZGlhQm94IFswIDAgNTk1LjI4IDg0MS44OV0KL0NvbnRlbnRzIDEyIDAgUgovUmVzb3VyY2VzIDEzIDAgUgo+PgplbmRvYmoKMTMgMCBvYmoKPDwKL1Byb2NTZXQgWy9QREYgL1RleHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUldCi9FeHRHU3RhdGUgPDwKL0dzMSA4IDAgUgo+PgovRm9udCA8PAovRjQgMTAgMCBSCi9GMTIgMTEgMCBSCj4+Cj4+CmVuZG9iagoxNyAwIG9iago8PAovVHlwZSAvUGFnZQovUGFyZW50IDIgMCBSCi9NZWRpYUJveCBbMCAwIDU5NS4yOCA4NDEuODldCi9Db250ZW50cyAxNSAwIFIKL1Jlc291cmNlcyAxNiAwIFIKPj4KZW5kb2JqCjE2IDAgb2
class Kijek
def roll_a_die
rand(100)
end
def win
puts 'Kijek: Jedź bezpieczeni Sarin!'
end
def loose
describe Admin::Merchant::Create do
subject(:result) { described_class.call(params) }
context "valid data" do
let(:params) {
{
name: "Death Star supplier",
category: "Space Merchants"
}
describe Admin::Merchant::Create do
subject(:result) { described_class.call(params) }
context "valid data" do
let(:params) {
{
name: "Death Star supplier",
category: "Space Merchants"
}
}
@panSarin
panSarin / MyRequests.js
Created January 20, 2015 12:51
Jasmine presentation source code - problem with response method
MyRequests.prototype.display_response = function(response){};
MyRequests.prototype.get_topics = function(bstokJS_stage) {
$.ajax({
type: 'GET',
url: 'https://gist.githubusercontent.com/panSarin/3d0e3080ee36e3b82c79/raw/8f496cfd22a766644b0ee834afb813ca1790c304/bstokjs'+bstokJS_stage+'.json',
contentType: "application/json; charset=utf-8",
@panSarin
panSarin / bstokjs2.json
Created January 20, 2015 12:39
bstok2.json
{'XX' : 'YYY', 'ZZ': 'AAA'}
@panSarin
panSarin / bstokjs1.json
Last active August 29, 2015 14:13
bstok1.json
{ 'KR' : 'Angular and stuff', 'AP' : 'Jasmine', 'AC' : 'AexolGl'}
@panSarin
panSarin / application_policy.rb
Last active August 29, 2015 14:04
Pundit policies and our controllers
class ApplicationPolicy
# ... content generated by pundit (its about access for actions - we will discuss it in part 2 of that blogpost)
class Scope # our default scope for each model
attr_reader :user, :scope
def initialize(user, scope)
@user = user
@scope = scope
end