Skip to content

Instantly share code, notes, and snippets.

View cored's full-sized avatar
🐔
Debugging Everything

Rafael George cored

🐔
Debugging Everything
View GitHub Profile
module Jobo
module Jobs
class ListGroupedByCategories
def self.list(job_repository)
new(job_repository).list
end
def initialize(job_repository)
@job_repository = job_repository
/home/homer/code/ruby/rails_projects/rails-stripe-membership-saas/
▸ app/
▸ config/
▸ db/
▸ features/
▸ lib/
▸ log/
▸ public/
▸ script/
▸ spec/
language: ruby
cache: bundler
bundler_args: --without production
rvm:
- 2.0
deploy:
api_key:
secure: TCqPS2eTNtmy/jIiro/WAMxEwRVd7coPPHISrVzez2kTpmxZzkqDYADQhwvXvCPzIr0upAz4B1WfWT3ovOoVhUsDdt59Rdlp8GiJWvF7W4nRXVLHyOU+vtkhuEbJAgx5wxzZfNFxJh/S0LNSLQWLaZZcOJJolxPT/Z5hZgAX1dc=
app: quiet-garden-2433
class JobsController < ApplicationController
def latest_active
@jobs = Jobo::Jobs::ListGroupedByCategories.list Job
end
def new
@job = Job.new
end
def create
@cored
cored / bleh
Created February 19, 2014 14:24
814.0: flog total
8.1: flog/method average
60.9: main#none
35.4: ApplicationController#store_location app/controllers/application_controller.rb:6
33.5: UsersController#update app/controllers/users_controller.rb:7
33.4: namespace(jasmine)::task#ci lib/tasks/jasmine.rake:28
32.1: Organization#none
20.7: CreateOrganizationFromArray#build_organization app/models/create_organization_from_array.rb:40
18.8: OrphansController#create app/controllers/orphans_controller.rb:13
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
unless (sign_in_url =~ request.path ||
sign_up_url =~ request.path ||
user_confirmation =~ request.path ||
sign_password =~ request.path ||
cookies_allow =~ request.path ||
request.xhr?) # don't store ajax calls
session[:previous_url] = request.path
end
def sign_in_url
Regexp.new '/users/sign_in'
end
def sign_up_url
Regexp.new '/users/sign_up'
end
def sign_password
Regexp.new '/users/password'
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
unless (request_path_includes?(sign_in_url) ||
request_path_includes?(sign_up_url) ||
request_path_includes?(user_confirmation) ||
request_path_includes?(sign_password) ||
request_path_includes?(cookies_allow) ||
request.xhr?) # don't store ajax calls
session[:previous_url] = request.path
end
obsController POST /create creates a new job
Failure/Error: expect(job_creator).to receive(:call).with(Job, job_attrs)
(Double :job_creator_service).call(Job(id: integer, location: string, position: string, company: string, created_at: datetime, updated_at: datetime, category_id: integer, type: integer, url: string, description: text, how_to_apply: string, public: boolean, email: string), {"id"=>nil, "location"=>"Washington", "position"=>"Direct Mobility Coordinator", "company"=>"Osinski-Kirlin", "created_at"=>nil, "updated_at"=>nil, "category_id"=>96, "type"=>nil, "url"=>nil, "description"=>nil, "how_to_apply"=>nil, "public"=>nil, "email"=>nil})
expected: 1 time with arguments: (Job(id: integer, location: string, position: string, company: string, created_at: datetime, updated_at: datetime, category_id: integer, type: integer, url: string, description: text, how_to_apply: string, public: boolean, email: string), {"id"=>nil, "location"=>"Washington", "position"=>"Direct Mobility Coordin
class SurveyInviter
EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/
def initialize(attributes = {})
@survey = attributes[:survey]
@message = attributes[:message] || ''
@recipients = attributes[:recipients] || ''
@sender = attributes[:sender]
end