Skip to content

Instantly share code, notes, and snippets.

View jmuheim's full-sized avatar

Josua Muheim jmuheim

View GitHub Profile
@codebeige
codebeige / rails_helper.rb
Created April 17, 2016 15:50
Assign locals context-wide when testing partials with rspec-rails
RSpec.configure do |config|
config.include TemplateLocals, type: :view
end
@toolmantim
toolmantim / host_based_tld_length.rb
Last active November 18, 2020 17:23
Reconfigures Rails ActionDispatch's TLD handling dynamically based on the request host, so you don't have to mess with config.action_dispatch.tld_length for cross-device testing using xip.io and friends
# Reconfigures ActionDispatch's TLD handling dynamically based on the request
# host, so you don't have to mess with config.action_dispatch.tld_length for
# cross-device testing using xip.io and friends
#
# Examples:
# use Rack::HostBasedTldLength, /xip\.io/, 5
class Rack::HostBasedTldLength
def initialize(app, host_pattern, host_tld_length)
@app = app