Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am fidothe on github.
  • I am fidothe (https://keybase.io/fidothe) on keybase.
  • I have a public key whose fingerprint is FA58 96E6 EE8E 6FD8 483C 6AE9 2EDA FDD2 5AB8 38C2

To claim this, I am signing this object:

@fidothe
fidothe / .ruby-version
Last active August 29, 2015 14:06
Capybara CSS / XPath selector spec problem
2.1.2
@fidothe
fidothe / gist:39d4ef9b8d84f8ddde77
Created March 18, 2015 09:14
Use PG JSON datatype with Lotus::Model (hacky hacky)
require 'lotus/model'
require 'json'
module Lotus::Model::Mapping::Coercions
def self.JSON(arg)
return nil if arg.nil?
case arg
when String
JSON.parse(arg)
else
@fidothe
fidothe / my_spec.rb
Created March 18, 2015 09:37
transaction-wrapped specs for Lotus::Model
require 'spec_helper'
RSpec.describe MyRepository, :db do
it "will be rolled back after completion" do
MyRepository.create(MyEntity.new)
expect(MyRepository.all.size).to eq(1)
end
it "will also be rolled back" do
MyRepository.create(MyEntity.new)
@fidothe
fidothe / eg_spec.rb
Created March 18, 2015 15:56
Approaching App Controller load problem
require 'spec_helper'
require_relative '../../../../apps/api/application'
RSpec.describe "Api::Controllers::Stuff::Create" do
let(:action) { Api::Controllers::Stuff::Create.new }
before(:all) do
Api::Application.preload!
end
@fidothe
fidothe / action.rb
Created March 18, 2015 16:05
poss other approach to apps loading problem
require 'api/application'
module Api
module Controllers
module Urls
class Add
include Api::Action
def call(params)
...
@fidothe
fidothe / spec-dowser.rb
Created June 26, 2015 18:33
dowsing for spec ordering issues
# encoding: utf-8
SEED = 6514
BASE_CMD = "bundle exec rspec --fail-fast --seed #{SEED}"
all_potential_files = Dir['spec/controllers/**/*_spec.rb', 'spec/features/**/*_spec.rb']
definitely_involved = ['spec/controllers/concerns/x.rb', 'spec/features/y.rb']
potential_files = all_potential_files.to_a - definitely_involved
def attempt(files)
- unless @confirmation_code.nil?
- form_for(:game_citizen, :url => confirm_game_citizen_path(@game_citizen)) do |f|
%p
= f.hidden_field(:confirmation_code, :value => @confirmation_code)
= f.submit('Confirm my account!')
- if current_user
- if current_user.staff?
.admin.panel
%p= link_to('Create Blog post', new_entry_path)
%p= link_to('Create Page', new_page_path)
.blog
#title
- unless entry_form.heading_image.nil? || !File.exist?(entry_form.heading_image.asset.path(:headline))
= image_tag(entry_form.heading_image.asset.url(:headline))
- else
= image_tag('headline_blank.png')
.image_upload
.threecolumn.noborder
- form_for(image_form, :url => assets_path, :html => {:enctype => 'multipart/form-data', :id => 'headline_image_form'}) do |f|
@fidothe
fidothe / mocha.rb
Created May 12, 2009 10:26 — forked from drnic/mocha.rb
# For mocha integration, add this file into features/support folder
require "mocha"
World(Mocha::Standalone)
Before do
mocha_setup
end