spec/jldrill/stories/PopupKanjiInfo_story.rb in jldrill-0.5.1.7 vs spec/jldrill/stories/PopupKanjiInfo_story.rb in jldrill-0.6.0.1
- old
+ new
@@ -1,5 +1,6 @@
+# encoding: utf-8
#require 'jldrill/contexts/DisplayProblemContext'
require 'jldrill/spec/StoryMemento'
require 'jldrill/views/test/CommandView'
require 'jldrill/views/test/ProblemView'
require 'jldrill/views/test/QuizStatusView'
@@ -8,24 +9,40 @@
module JLDrill::PopupKanjiInfo
Story = JLDrill::StoryMemento.new("Pop up kanji info")
def Story.setup(type)
super(type)
-# @context = @mainContext.displayProblemContext
-# @view = @context.peekAtView
+ @context = @mainContext.displayProblemContext
+ @view = @context.peekAtView
end
-###########################################
- describe Story.stepName("The user is able to select popup kanji option") do
- it "should have an entry in the menu" do
+ describe Story.stepName("The user should see kanji information") do
+
+ def loadKanji
+ Story.mainContext.loadKanjiContext.kanaFile = JLDrill::Config::getDataDir + "/tests/kanji.dat"
+ Story.mainContext.loadKanjiContext.radicalsFile = JLDrill::Config::getDataDir + "/tests/radicals.dat"
+ Story.mainContext.loadKanjiContext.kanjiFile = JLDrill::Config::getDataDir + "/tests/kanji.dat"
+ Story.mainContext.loadKanji
+ end
+
+ it "should load the kanji info" do
Story.setup(JLDrill::Test)
Story.start
+ loadKanji()
+ Story.mainContext.kanji.kanjiList.size.should be(100)
Story.shutdown
end
-
-# it "Selecting the entry in the menu should enter the context"
- end
-###########################################
+ it "should be able to find the kanji items" do
+ Story.setup(JLDrill::Test)
+ Story.start
+ loadKanji()
+ Story.mainContext.kanji.kanjiList.size.should be(100)
+ oString = JLDrill::Kanji.parse("事|B6 G3 S8 F18 N272 V71 H3567 DK2220 L1156 IN80 P4-8-3 I0a8.15 Yshi4|ジ ズ こと つか.う つか.える|ろ||matter, thing, fact, business, reason, possibly\n").withRadical_to_s(Story.mainContext.radicals.radicalList)
+ Story.context.kanjiInfo("事").should eql(oString)
+ Story.shutdown
+ end
+
+ end
end