Sha256: afee62401e260ed55fd3d34c19a1b486bba7275fe50919d31631808f633c3fb8

Contents?: true

Size: 1.21 KB

Versions: 10

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_client.database.collections.each do |collection|
			collection.drop
		end
	end
end

Version data entries

10 entries across 7 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-io-mongodb-6cbfeb61de5c/spec/spec_helper.rb
tdiary-io-mongodb-5.1.0 spec/spec_helper.rb
tdiary-io-mongodb-5.0.4 spec/spec_helper.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/bundler/gems/tdiary-io-mongodb-d8d5bf37608d/spec/spec_helper.rb
tdiary-5.0.5 vendor/bundle/bundler/gems/tdiary-io-mongodb-3047266c9611/spec/spec_helper.rb
tdiary-5.0.5 vendor/bundle/bundler/gems/tdiary-io-mongodb-d8d5bf37608d/spec/spec_helper.rb
tdiary-5.0.4 vendor/bundle/bundler/gems/tdiary-io-mongodb-d8d5bf37608d/spec/spec_helper.rb
tdiary-io-mongodb-5.0.3 spec/spec_helper.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/bundler/gems/tdiary-io-mongodb-c85077675fce/spec/spec_helper.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/bundler/gems/tdiary-io-mongodb-c85077675fce/spec/spec_helper.rb