Sha256: b6267f6118d6bdd451fb3d2d687104a510056be54ea2a18ae8e97d6e9db8d1d7

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'rad'
require 'rad/spec'

require 'mongo/model'
require 'mongo/model/spec'


#
# SaaS
#
unless ENV['saas'] == 'false'
  begin
    require 'saas/spec'
  rescue LoadError
  end
end


#
# User
#
rad.register :user
rspec do
  def login_as user
    rad.user = user
  end

  def self.login_as name, options = {}
    before do
      @user = Factory.create name, options
      login_as @user
    end
  end
end


#
# CarrierWave
#
# module Rad::CarrierWaveSpecHelper
#   def with_files
#     before do
#       rad.config.fs_path       = CarrierWaveExtSpecHelper::TEST_PATH
#       rad.config.fs_cache_path = CarrierWaveExtSpecHelper::TEST_CACHE_PATH
#
#       Models::BaseFile.storage :file
#     end
#
#     super
#   end
# end
# rspec.extend Rad::CarrierWaveSpecHelper


#
# Miscellaneous
#
rspec do
  alias_method :call, :wcall
  alias_method :pcall, :post_wcall
  alias_method :set_call, :set_wcall

  class << self
    def with_models
      with_mongo_model
      with_file_model
      rad.extension :with_models, self
    end

    def with_controllers
      with_models
    end
  end
end

require 'kit/spec/items_controller_crud'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rad_kit-0.0.10 lib/kit/spec.rb
rad_kit-0.0.9 lib/kit/spec.rb