Sha256: 08ba6a9176ad1130d35165fd03e2d647207b82c85f674a3322c1dd2814c5667a

Contents?: true

Size: 1.66 KB

Versions: 12

Compression:

Stored size: 1.66 KB

Contents

require 'machinist/object'
require 'sham'
require 'faker'
require 'pry'
require 'mongoid'
require 'ransack'

I18n.enforce_available_locales = false
Time.zone = 'Eastern Time (US & Canada)'
I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'support', '*.yml')]

Dir[File.expand_path('../{mongoid/helpers,mongoid/support,blueprints}/*.rb', __FILE__)]
.each do |f|
  require f
end

Sham.define do
  name        { Faker::Name.name }
  title       { Faker::Lorem.sentence }
  body        { Faker::Lorem.paragraph }
  salary      { |index| 30000 + (index * 1000) }
  tag_name    { Faker::Lorem.words(3).join(' ') }
  note        { Faker::Lorem.words(7).join(' ') }
  only_admin  { Faker::Lorem.words(3).join(' ') }
  only_search { Faker::Lorem.words(3).join(' ') }
  only_sort   { Faker::Lorem.words(3).join(' ') }
  notable_id  { |id| id }
end

RSpec.configure do |config|
  config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior'

  config.before(:suite) do
    puts '=' * 80
    connection_name = Mongoid.default_session.inspect
    puts "Running specs against #{connection_name}, Mongoid #{
      Mongoid::VERSION}, Moped #{Moped::VERSION} and Origin #{Origin::VERSION}..."
    puts '=' * 80
    Schema.create
  end

  config.before(:all)   { Sham.reset(:before_all) }
  config.before(:each)  { Sham.reset(:before_each) }

  config.include RansackHelper
end

RSpec::Matchers.define :be_like do |expected|
  match do |actual|
    actual.gsub(/^\s+|\s+$/, '').gsub(/\s+/, ' ').strip ==
      expected.gsub(/^\s+|\s+$/, '').gsub(/\s+/, ' ').strip
  end
end

RSpec::Matchers.define :have_attribute_method do |expected|
  match do |actual|
    actual.attribute_method?(expected)
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
ransack-1.7.0 spec/mongoid_spec_helper.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ransack-1.6.6/spec/mongoid_spec_helper.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ransack-1.6.6/spec/mongoid_spec_helper.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ransack-1.6.6/spec/mongoid_spec_helper.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/ransack-1.6.2/spec/mongoid_spec_helper.rb
ransack-1.6.6 spec/mongoid_spec_helper.rb
ransack-1.6.5 spec/mongoid_spec_helper.rb
ransack-1.6.4 spec/mongoid_spec_helper.rb
ransack-1.6.3 spec/mongoid_spec_helper.rb
ransack-1.6.2 spec/mongoid_spec_helper.rb
ransack-1.6.1 spec/mongoid_spec_helper.rb
ransack-1.6.0 spec/mongoid_spec_helper.rb