Sha256: abcc09a1f05ec9a7f5e59d66ff7484b6c885b10050e66283c791e79ba13e795f

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'tdiary/comment_manager'
require 'tdiary/comment'
require 'tdiary/referer_manager'
require 'tdiary/cache/file'
require 'tdiary/io/mongodb'

module TDiary
	class TDiaryBase
		DIRTY_NONE = 1
		DIRTY_DIARY = 1
		DIRTY_COMMENT = 2
	end

	module IO
		class MongoDB 
			def initialize(tdiary)
				@tdiary = tdiary
			end

			def style(style)
				DummyStyle
			end
		end
	end
end

class DummyTDiary
	def conf
		DummyConf.new
	end

	def ignore_parser_cache
		false
	end
end

class DummyConf
	def database_url
		'mongodb://localhost:27017/tdiary_test'
	end

	def cache_path
		nil
	end
end

class DummyStyle
	attr_accessor :title, :to_src

	def initialize(id, title, body, last_modified)
		@title = title
		@to_src = body
	end

	def style
		"dummy"
	end

	def last_modified
		Time.now
	end

	def visible?
		true
	end

	def show(dummy); end

	def add_comment(com)
		@comments ||= []
		@comments << com
	end

	def count_comments(dummy)
		(@comments || []).size
	end

	def each_comment(limit)
		(@comments || []).each{|com| yield com}
	end
end

RSpec.configure do |c|
	c.after(:suite) do
		Mongoid.default_session.collections.each do |collection|
			collection.drop
		end
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tdiary-io-mongodb-4.2.0 spec/spec_helper.rb
tdiary-io-mongodb-4.1.2 spec/spec_helper.rb
tdiary-io-mongodb-4.1.1.3 spec/spec_helper.rb
tdiary-io-mongodb-4.1.1.2 spec/spec_helper.rb
tdiary-io-mongodb-4.1.1.1 spec/spec_helper.rb
tdiary-io-mongodb-4.1.1 spec/spec_helper.rb
tdiary-io-mongodb-0.0.2 spec/spec_helper.rb
tdiary-io-mongodb-4.1.0 spec/spec_helper.rb
tdiary-io-mongodb-0.0.1 spec/spec_helper.rb