Sha256: c4ee6f127bae1c4359be496114a415f53d616fbd99ee74ba5e3cb17f3da54fe5

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

require 'simplecov'
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  SimpleCov::Formatter::HTMLFormatter,
  Coveralls::SimpleCov::Formatter
]

SimpleCov.start do
  add_filter 'spec'
end

require 'admino'
require 'pry'
require 'rspec-html-matchers'

I18n.enforce_available_locales = true
I18n.available_locales = [:en]
I18n.locale = :en

class ScopeMock
  attr_reader :chain, :name

  def initialize(name = nil, chain = [])
    @name = name
    @chain = chain
  end

  def method_missing(method_name, *args, &block)
    ::ScopeMock.new(name, chain + [method_name, args])
  end
end

class TestQuery < Admino::Query::Base
  search_field :foo
  search_field :starting_from, coerce: :to_date

  filter_by :bar, [:one, :two], include_empty_scope: true

  sorting :by_title, :by_date,
          default_scope: :by_title,
          default_direction: :desc

  starting_scope { 'start' }
  ending_scope { 'end' }
end

class Post < Struct.new(:key, :dom_id)
  extend ActiveModel::Naming
  extend ActiveModel::Translation

  def title
    "Post #{key}"
  end

  def author_name
    "steffoz"
  end

  def to_param
    key
  end

  def to_key
    [key]
  end
end

require 'action_view'

class RailsViewContext < ActionView::Base
  include ActionView::Helpers::TagHelper
end

RSpec.configure do |c|
  c.before(:each) do
    I18n.backend = I18n::Backend::Simple.new
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admino-0.0.10 spec/spec_helper.rb
admino-0.0.9 spec/spec_helper.rb