Sha256: a86c445d2fe6ea5112d652f839c5726eb02c5bfb2551c5349b89df8a6f0d29c8
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' ENV['AHN_ENV'] = 'test' describe Adhearsion::Mongoid::Plugin::Service do describe "when starting the Mongoid connection" do def tmp_models_dir_path path = File.join Dir.tmpdir, "models" unless File.directory? path FileUtils.mkdir path end path end def create_tempmodel_with_contents(contents) path = File.join tmp_models_dir_path, "user.rb" file = File.new(path, "w+") file.puts contents file.flush path end def sample_user_model <<-CODE class User include Mongoid::Document field :name, type: String end CODE end it "should make any required models available" do path = create_tempmodel_with_contents sample_user_model Adhearsion.config.adhearsion_mongoid.models_paths = [tmp_models_dir_path] Adhearsion::Mongoid::Plugin::Service.start u = User.new u.should respond_to :name File.delete path Dir.delete tmp_models_dir_path end end end
Version data entries
3 entries across 3 versions & 1 rubygems