Skip to content

Instantly share code, notes, and snippets.

NealJMD

Block or report user

Report or block NealJMD

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NealJMD
NealJMD / liquid_i18n_spec.rb
Created Jan 22, 2016
Rspec tests for LiquidI18n module which allows use of Rails I18n API in liquid templates. LiquidI18n module can be found [here](https://gist.github.com/NealJMD/c340dbe54f46f84fe480).
View liquid_i18n_spec.rb
require 'rails_helper'
describe LiquidI18n do
# to define a liquid filter, you make a module with instance methods that
# gets included by liquid. You can't make them module_functions, so here
# we extend a generic class to call the filter
subject { Class.new.extend(LiquidI18n) }
before :all do
@NealJMD
NealJMD / liquid_i18n.rb
Last active Nov 29, 2017
Rails I18n in Liquid templating, including interpolated values. Spec can be found at https://gist.github.com/NealJMD/16cf509164bb71215a87
View liquid_i18n.rb
# The <tt>LiquidI18nRails</tt> module allows us to use the +translate+
# method of Rails' I18n library within liquid templates. To use it,
# simply pass the name of the text entry to the +t+ filter:
#
# {{ 'fundraiser.thank_you' | t }}
#
# The above tag is equivalent to calling:
#
# I18n.t('fundraiser.thank_you')
#
View gist:99f04b3225085a4fbf0a
ShareProgress::Button
instance methods
should respond to #page_url
should respond to #page_url=
should respond to #button_template
should respond to #button_template=
should respond to #page_title
should respond to #page_title=
should respond to #share_button_html
should respond to #share_button_html=
You can’t perform that action at this time.