This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'notifications/client' | |
| def client | |
| @client ||= Notifications::Client.new(ENV['SETTINGS__GOVUK_NOTIFY__API_KEY']) | |
| end | |
| def notifications args | |
| client.get_notifications(args) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UserAgentHelper | |
| extend ActiveSupport::Concern | |
| Browser = Struct.new(:browser, :version) | |
| SUPPORTED_BROWSER_BLACKLIST = [ | |
| Browser.new(UserAgent::Browsers::InternetExplorer.new.browser, UserAgent::Version.new('7.0')) | |
| ].freeze | |
| included do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Capybara | |
| module Node | |
| module Actions | |
| alias_method :old_check, :check | |
| alias_method :old_uncheck, :uncheck | |
| def check locator | |
| Capybara.current_session.evaluate_script js_element_check(locator, true) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Capybara | |
| module Node | |
| module Actions | |
| alias_method :old_check, :check | |
| alias_method :old_uncheck, :uncheck | |
| def check(locator, options = {}) | |
| Capybara.current_session.evaluate_script js_element_check(locator, true) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* for versions below 10 */ | |
| <!--[if IE]> | |
| <link rel="stylesheet" type="text/css" href="all-ie-only.css" /> | |
| <![endif]--> | |
| @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { | |
| /* IE10+ CSS styles go here */ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'netaddr' | |
| class IpAddressMatcher | |
| def initialize(terms) | |
| @cidrs = cidrs(terms) | |
| end | |
| def ===(other) | |
| @cidrs.any? { |cidr| cidr.matches?(other) } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A simple custom validator that validates the size attribute of | |
| # the records specified file attribute. | |
| # | |
| # examples: | |
| # - validates :image, file_size: { maximum: 3.megabytes } | |
| # - validates :file, file_size: { range: 1.kilobyte..3.megabytes, message: 'not in 1KB to 3MB range' } | |
| # | |
| class FileSizeValidator < ActiveModel::EachValidator | |
| attr_reader :size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rspec/expectations' | |
| module DelayedJobHelper | |
| RSpec::Matchers.define :delay_method do |expected| | |
| def supports_block_expectations? | |
| true | |
| end | |
| match do |proc| |
NewerOlder