Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'test_plugin_pr' of git://github.com/zunda/tdiary-core i…
…nto zunda-test_plugin_pr
- Loading branch information
Showing
3 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Test cases for test_plugin_helper.rb | ||
require File.expand_path('../test_helper', __FILE__) | ||
require File.expand_path('../test_plugin_helper', __FILE__) | ||
|
||
class TestPluginHelper < TDiary::PluginTestCase | ||
def test_absolute_path_of | ||
abspath = File.expand_path(File.join(File.dirname(__FILE__), '..', 'plugin', '00default.rb')) | ||
assert_equal(abspath, TDiary::PluginTestHelper.absolute_path_of('plugin/00default.rb')) | ||
end | ||
|
||
def test_resource_absolute_path_of | ||
abspath = File.expand_path(File.join(File.dirname(__FILE__), '..', 'plugin', 'en', '00default.rb')) | ||
assert_equal(abspath, TDiary::PluginTestHelper.resource_absolute_path_of('plugin/00default.rb', 'en')) | ||
end | ||
|
||
def test_resource_relative_path_of | ||
abspath = File.join('plugin', 'en', '00default.rb') | ||
assert_equal(abspath, TDiary::PluginTestHelper.resource_relative_path_of('plugin/00default.rb', 'en')) | ||
end | ||
|
||
def test_load_plugin_en | ||
assert_nothing_raised{load_plugin('plugin/00default.rb', 'en', binding)} | ||
end | ||
|
||
def test_load_plugin_ja | ||
assert_nothing_raised{load_plugin('plugin/00default.rb', 'ja', binding)} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require File.expand_path('../test_helper', __FILE__) | ||
require File.expand_path('../test_plugin_helper', __FILE__) | ||
|
||
module EmptyRenderingTests | ||
def setup | ||
load_plugin('misc/plugin/weather.rb', language, binding) | ||
@weather = Weather.new | ||
end | ||
|
||
def test_empty_rendering_to_html | ||
assert_equal('', @weather.to_html) | ||
end | ||
|
||
def test_empty_rendering_to_i_html | ||
assert_equal('', @weather.to_i_html) | ||
end | ||
end | ||
|
||
class TestEmptyRenderingEn < TDiary::PluginTestCase | ||
include EmptyRenderingTests | ||
|
||
def language | ||
"en" | ||
end | ||
end | ||
|
||
class TestEmptyRenderingJa < TDiary::PluginTestCase | ||
include EmptyRenderingTests | ||
|
||
def language | ||
"ja" | ||
end | ||
end |