1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
heartcombo--simple_form/test/support/misc_helpers.rb
2010-09-26 19:39:02 -03:00

31 lines
683 B
Ruby

module MiscHelpers
def store_translations(locale, translations, &block)
begin
I18n.backend.store_translations locale, translations
yield
ensure
I18n.reload!
end
end
def assert_no_select(selector, value = nil)
assert_select(selector, :text => value, :count => 0)
end
def swap(object, new_values)
old_values = {}
new_values.each do |key, value|
old_values[key] = object.send key
object.send :"#{key}=", value
end
yield
ensure
old_values.each do |key, value|
object.send :"#{key}=", value
end
end
def with_concat_form_for(object, &block)
concat simple_form_for(object, &block)
end
end