Skip to content

Instantly share code, notes, and snippets.

@channainfo
Created July 27, 2022 10:17
Show Gist options
  • Save channainfo/7ce691c8c13aff29baa924f39956857b to your computer and use it in GitHub Desktop.
Save channainfo/7ce691c8c13aff29baa924f39956857b to your computer and use it in GitHub Desktop.
Disable callback in rspec
#Disable XLIFF validation for all specs
config.before :all do
XliffUploader._before_callbacks.delete(:store)
end
#Enable XLIFF validation only for specs with ":enable_xliff_validation => true"
config.before :each, :enable_xliff_validation => true do
XliffUploader._before_callbacks[:store] = [:validate_xliff]
end
config.after :each, :enable_xliff_validation => true do
XliffUploader._before_callbacks.delete(:store)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment