Sha256: fa1155b36c7d1016c40d7a3e3d9e919b4a35c3a7473148df96205448dd418575

Contents?: true

Size: 1.67 KB

Versions: 7

Compression:

Stored size: 1.67 KB

Contents

# Test cases for test_plugin_helper.rb
require File.expand_path('../test_helper', __FILE__)
require File.expand_path('../test_plugin_helper', __FILE__)

class TestPluginTestHelper < Test::Unit::TestCase
	include TDiary::PluginTestHelper

	def test_absolute_path_of
		abspath = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'tdiary', 'plugin', '00default.rb'))
		assert_equal(abspath, TDiary::PluginTestHelper.absolute_path_of('lib/tdiary/plugin/00default.rb'))
	end

	def test_resource_absolute_path_of
		abspath = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'tdiary', 'plugin', 'en', '00default.rb'))
		assert_equal(abspath, TDiary::PluginTestHelper.resource_absolute_path_of('lib/tdiary/plugin/00default.rb', 'en'))
	end

	def test_resource_relative_path_of
		abspath = File.join('lib', 'tdiary', 'plugin', 'en', '00default.rb')
		assert_equal(abspath, TDiary::PluginTestHelper.resource_relative_path_of('lib/tdiary/plugin/00default.rb', 'en'))
	end

	def test_new_plugin
		assert_nothing_raised do
			TDiary::StubPlugin::new_plugin('lib/tdiary/plugin/00default.rb', 'en')
		end
	end

	def test_load_plugin
		assert_nothing_raised do
			TDiary::StubPlugin::load_plugin('lib/tdiary/plugin/00default.rb', 'en')
		end
	end

	def test_plugin_conf
		plugin = TDiary::StubPlugin::load_plugin('lib/tdiary/plugin/00default.rb', 'en')
		assert_nothing_raised do
			plugin.conf['key'] = 'value'
		end
		assert_equal('value', plugin.conf['key'])
	end

	def test_plugin_options
		plugin = TDiary::StubPlugin::load_plugin('lib/tdiary/plugin/00default.rb', 'en')
		assert_nothing_raised do
			plugin.options['key'] = 'value'
		end
		assert_equal('value', plugin.options['key'])
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/tdiary-4.2.0/test/test_plugin_helper_test.rb
tdiary-4.2.0 test/test_plugin_helper_test.rb
tdiary-4.1.3 test/test_plugin_helper_test.rb
tdiary-4.1.2 test/test_plugin_helper_test.rb
tdiary-4.1.1 test/test_plugin_helper_test.rb
tdiary-4.1.0 test/test_plugin_helper_test.rb
tdiary-4.1.0.20141126 test/test_plugin_helper_test.rb