Sha256: 045e9c6f083ac96dd73eaaf4e22ff21288c317f983436cec58b932f0593a5e85

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 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, default: 'bar'
  search_field :starting_from, coerce: :to_date

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

  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'
require 'simple_form'
require 'simple_form/action_view_extensions/form_helper'

class RailsViewContext < ActionView::Base
  include ActionView::Helpers::TagHelper
  include SimpleForm::ActionViewExtensions::FormHelper
  include Admino::ActionViewExtension

  def request
    OpenStruct.new(path: '/', fullpath: '/?p=1')
  end

  def polymorphic_path(*args)
    '/'
  end
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.14 spec/spec_helper.rb
admino-0.0.13 spec/spec_helper.rb