Skip to content

Instantly share code, notes, and snippets.

View k-rudy's full-sized avatar

Konstantin Rudy k-rudy

  • Intellum
  • Gdańsk, Poland
View GitHub Profile
@k-rudy
k-rudy / multi-parameter_attributes_spec.rb
Last active September 6, 2016 13:02
Multiparameter Attributes support in Mongoid 4 (Rails 4.0.1) Code is taken from https://github.com/mongoid/mongoid/issues/2954 with minor amendments to work with Rails 4.0.1
# This class is needed since Mongoid doesn't support Multi-parameter
# attributes in version 4.0 before it's moved to active model in rails 4
#
# https://github.com/mongoid/mongoid/issues/2954
#
require "spec_helper"
describe Mongoid::MultiParameterAttributes do
@jeremy2
jeremy2 / database.yml.erb
Created March 6, 2012 23:17
Engine Yard custom Chef Recipe for generating database.yml configuration file
#
# This file should be in .../cookbooks/database/templates/default/database.yml.erb
#
<%= @environment %>:
adapter: <%= @adapter %>
database: <%= @database %>
username: <%= @username %>
password: <%= @password %>
host: <%= @host %>
@mattwynne
mattwynne / be_same_file_as.rb
Last active May 21, 2022 13:27
RSpec matcher to compare two file, using their MD5 hashes
RSpec::Matchers.define(:be_same_file_as) do |exected_file_path|
match do |actual_file_path|
expect(md5_hash(actual_file_path)).to eq(md5_hash(expected_file_path))
end
def md5_hash(file_path)
Digest::MD5.hexdigest(File.read(file_path))
end
end