decaffeinatedpolicefart
decaffeinatedpolicefart
23:33
11 posts
software engineeress
Don't wanna be here? Send us removal request.
decaffeinatedpolicefart · 3 years ago
Text
delegating methods
delegate
fun trick!
0 notes
decaffeinatedpolicefart · 3 years ago
Text
handling stubbing errors
I wanted to stub a method call to raise an error for a test case, but I ran into an error:
allow_any_instance_of(MyClass).to receive(:foo).and_return("bar")
I got this error message:
Using any_instance to stub a method (foo) that has been defined on a prepended module (#<Module:0x0123>) is not supported.
A super easy fix for that was to create a double instance of my class:
let(:my_class_instance) { double(MyClass, foo: "bar") }
and then:
before do
allow(MyClass).to receive(:new).and_return(my_class_instance)
end
Tumblr media
0 notes
decaffeinatedpolicefart · 3 years ago
Text
Adding foreign key using strong migrations gem
if the table is small, just wrap everything in a safety_assured block and you can add the foreign key and reference in one single migration.
Just don't forget to run a backfill task to normalize your data!
0 notes
decaffeinatedpolicefart · 3 years ago
Text
0 notes
decaffeinatedpolicefart · 3 years ago
Text
0 notes
decaffeinatedpolicefart · 3 years ago
Text
movie recommendations!
0 notes
decaffeinatedpolicefart · 3 years ago
Text
0 notes
decaffeinatedpolicefart · 3 years ago
Text
to replace your local branch with the remote branch
git fetch / git reset --hard origin/feature-branch
0 notes
decaffeinatedpolicefart · 3 years ago
Text
query performance log
ActiveRecord::Base.logger = Logger.new(STDOUT)
0 notes
decaffeinatedpolicefart · 3 years ago
Text
environment.rb
# Set to Logger::DEBUG for detailed SQL logging in environment.rb
ActiveRecord::Base.logger.level = Logger::DEBUG
0 notes
decaffeinatedpolicefart · 3 years ago
Text
well..if that's what tumblr suggested as my tumblog name
so be it
1 note · View note