Skip to content

Instantly share code, notes, and snippets.

View patrick99e99's full-sized avatar

Patrick Collins patrick99e99

  • collinator studios
  • Saratoga Springs, Utah
View GitHub Profile
Feature: Updating an existing request
In order to change my mind about what I need
I want to be able to edit my Request
Background:
Given I am logged in with facebook
And I go to the new request page
And I fill in the following:
| I want | Dragon's Lair Arcade Game |
| for | 2000 |
@patrick99e99
patrick99e99 / i18n_matchers.rb
Last active February 6, 2020 16:25
I18n matchers for rspec 2
RSpec::Matchers.define :translate_to do |key, options|
match do |actual|
@expected = I18n.t(key, options)
@failure = nil
@failure ||= :bad_actual if actual.start_with?('translation missing:')
@failure ||= :bad_expected if @expected.start_with?('translation missing:')
@failure ||= :no_match if @expected != actual
@failure.nil?
end
~>curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: api.example.com" -H "Origin: https://www.example.com" https://api.example.com/socket
HTTP/2 301
date: Tue, 26 Jun 2018 02:27:07 GMT
content-type: application/json
content-length: 4
location: https://localhost:9999/localhost
server: restify
access-control-allow-origin: https://www.example.com
vary: origin
access-control-expose-headers: api-version, content-length, content-md5, content-type, date, request-id, response-time
var Core = (function($) {
return {
modules: {},
addModule: function(module_name, fn) {
// create new sandbox for module
var sandbox = new Sandbox(module_name);
describe OffersController do
def do_create
post :create, { :post_id => bb_request.id, :offer => new_offer.attributes }
end
shared_examples "an access controlled action" do |action_proc|
it "denies access if the post is not verified" do
expect(&action_proc).to raise_error(CanCan::AccessDenied)
end
end
## my routes file
resources :users do
get :redeem, :on => :member
end
I want to be able to do:
redeem_user_path(@user, @user.code)
module Bar
end
class Foo
include Bar
end
puts Foo:CONS => Error
module Bar
GEM
remote: http://rubygems.org/
specs:
POpen4 (0.1.4)
Platform (>= 0.4.0)
open4
Platform (0.4.0)
actionmailer (3.2.3)
actionpack (= 3.2.3)
mail (~> 2.4.4)
class Contact < ActiveRecord::Base
has_many :phones
end
@patrick99e99
patrick99e99 / contacts
Created April 28, 2012 18:09
contact migration
class CreateContacts < ActiveRecord::Migration
def self.up
create_table :contacts do |t|
t.string :first_name
t.string :last_name
t.timestamps
end
end