Sha256: 088ed46ba721374865f16e10268f65209fe0ad152b0b3e8e6a0c92a138745a50

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

require 'active_support/time'
require 'timecop'
require 'timeliness'
require 'timeliness/core_ext'

module TimelinessHelpers
  def parser
    Timeliness::Parser
  end

  def definitions
    Timeliness::Definitions
  end

  def parse(value, type=nil, **args)
    Timeliness::Parser.parse(value, type, **args)
  end

  def current_date(options={})
    Timeliness::Parser.send(:current_date, options)
  end

  def should_parse(value, type=nil, **args)
    expect(Timeliness::Parser.parse(value, type, **args)).not_to be_nil
  end

  def should_not_parse(value, type=nil, **args)
    expect(Timeliness::Parser.parse(value, type, **args)).to be_nil
  end
end

I18n.available_locales = ['en', 'es']

RSpec.configure do |c|
  c.mock_with :rspec
  c.include TimelinessHelpers

  c.after do
    Timeliness.configuration = Timeliness::Configuration.new
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timeliness-0.5.0 spec/timeliness_helper.rb