RSpec Code Examples

 

 

Context::View
should set the context on creation
should use the widgets to add a view
should use the widgets to remove a view
Context::PageView
should close the context when the view is closed
Context::Gtk::PageView
should have a widget when initialized
should add widgets from another view when added
should remove widgets from another view when removed
should react to destroy signals
Context::Bridge
should reference classes in the namespace provided
Context::Publisher
should have a source
should be able to subscribe to a publisher
should be able to update streams that aren't subscribed to
should be able to subscribe multiple targets to a publisher
should be able to change the source
Context::Context
should not have a parent set on creation
should set the parent on entry
should add new views to the main view
should remove views on exit
should create the views on entry
should destroy the views on exit
should keep track if the context has been entered or not
Kernel
should have a unit test for require_all
Context::Gtk::App
should start the Gtk main loop when run
should quit the Gtk main loop when quit
Context::Gtk::Widget
should keep track of the main Window
JLDrill::Gtk::MainWindowView
should have a widget when initialized
should react to destroy signals
should have an icon
JLDrill::Gtk::StatisticsView
should close the view when the window is destroyed
JLDrill::ShowStatisticsContext::StatisticsView
should be able to update the statistics in the view
should exit the context when the view is closed
JLDrill::ShowStatisticsContext
should be created by the main context
should have a view
should not be able to create the context twice at once
should not show statistics if there is no quiz
should update the view with the parent's quiz statistics on entry
JLDrill::SetOptionsContext
should be created by the main context
should update the view with the parent's quiz options on entry
should update the parent's quiz options with the views options on exit
should not update the parent's quiz options when cancelled
should not run the options dialog if there is no quiz
JLDrill::MainContext
should open the main view when it is entered
should exit the App when it is exited
should enter the loadReferenceContext when loading the reference
should enter the showStatisticsContext when showing statistics
should not try to open files if it doesn't get a filename
should load drill files as drill files
JLDrill::GetFilenameContext
should be created by the main context
should immediately exit the context after entering it
should set the filename and directory from the view
JLDrill::Deinflection::Reason
should be able to parse an reason from the deinflect file
JLDrill::Deinflection::Reason
should parse a reason
JLDrill::DeinflectionRulesFile
should load the file properly
JLDrill::Vocabulary
should be able to parse vocabulary from strings
should be able to tell a valid vocabulary from invalid
should not break the parser to try to parse nonsense
should be able to assign the contents of one Vocabulary to another
should be able to set definitions and markers
should set definitions and markers to nil if empty
should be able to set kanji, reading and hint
should set kanji, reading and hint to nil if empty
should be able to insert carriage returns
should be able to insert quotes
should be able to make a clone
should parse commas properly
should have a hash based on the reading and kanji
JLDrill::Meaning
should have types and usages when created
should be able to parse a single usage
should be able to parse a single usage with types
should be able to parse a specific single usage with types
should be able to parse a meaning with types and a specific single usage without types
should be able to parse a meaning with types and a specific single usage with types
should be able to parse multiple usages
should be able to get all types in the meaning
should be able to get all definitions in the meaning
should be able to output the meaning as a string
JLDrill::Definition
should have a value and types when created
should be able to parse Edict definitions
should be able to parse Edict definitions with a type
should be able to parse Edict definitions with many types
should pick up multiple sets of types
should be able to match equivalence
should be able to handle parenthesis
should be able to handle special language tags
JLDrill::Usage
should have a value and types when created
should be able to parse Edict usages
should be able to output the edict usage again
JLDrill::GrammarType
should have a list of grammar markings
should be able to look up the types
should be able to look up the special language tags
should be able to parse a string of types
should be able to reject non-types
JLDrill::Radical
should be able to parse an entry from the radkfile
should be able to parse an entry with an alternate glyph
should be able to parse an entry with multiple alternate glyphs
JLDrill::RadicalList
should be able to parse a file in a string
should be able to parse a file on disk
JLDrill::KanaFile
should be able to read the file in chunks
JLDrill::Config
should have a DATA_DIR
should not be using the Gem DATA_DIR in the tests
should use the Gem::datadir if set
JLDrill::Kanji
should be able to parse an entry from the kanji file
JLDrill::KanjiList
should be able to parse a file in a string
should be able to parse a file on disk
JLDrill::Item
should be able to swap the positions of items
JLDrill::Counter
should create the ranges properly
should count properly
JLDrill::Strategy
should be able to return the status
should increment the statistics if correct in bin 4
should decrement the statistics if incorrect in bin 4
should use the contents from the quiz
should only pick unseen items
should demote bin 0 items to bin 0 and reset the level to 0
should demote other items to bin 1 and reset the level to 0
should be able to create problems of the correct level
should be able to tell if the working set is full
should be able to tell if the review set needs reviewing
should not review if all the items in the review set are seen
should increment the item's difficulty when an item is incorrect
should not reset the difficulty when the item is demoted from the 4th bin
should reset the consecutive counter on an incorrect answer
JLDrill::Statistics
should start with an estimate of 0
should have an accuracy of 100 if all are correct
should set the accuracy correctly
should slowly move the estimate towards 100
should keep track of the last ten responses
should keep track of the recent (up to 10 items) accuracy
should calculate the confidence that the probability is > 90
JLDrill::Contents
should indicate if a range of bins has contents
should add items to the last position if the position is set to -1
should be able to print out the status
should be able to count the unseen items in a range
should be able to find the nth unseen item in the contents
should be able to add items to the contents only if they dont already exist
should be able to add the contents from another quiz to this one
JLDrill::LevelStats
should count the total number of trials
should keep track of the percentage correct
JLDrill::Quiz
should have the contents
should load a file from memory
should save a file to a string
should be able to load files of the current version
should be able to get a list of all the items
should be able to reset the contents
should renumber the contents when resetting
should be able to move an item from one bin to the other
should be able to create a new Problem
should eventually promote all items to bin 4
should use the promote threshold when promoting
should update the last reviewed status when the answer is made
should update the schedule correctly for bin 4 items
should notify subscribers of updates
should notify subscribers when a new problem has been created
should be able to find paths relative to the save name
JLDrill::Duration
should create an invalid duration with no argument
should create a duration of the required length
should parse a duration from a string
should output the duration in days
should output the duration as a string
should assign durations properly
JLDrill::Bin
should have a name and number when constructed
should be able to push a vocabulary
should be able to iterate through the bin using each()
should be able to delete an item
should be able to sort
should output itself in save format
should indicate if the bin is empty
should indicate if all the items in the bin have been seen
should be able to find the first unseen item
should be able to set all the items to unseen
should be able to count the number of unseen items
should be able to find the nth unseen item in the bin
should be able to tell if an item exists in the bin
JLDrill::Tanaka::Reference
should be able to parse an entry from the Reference file
should be able to parse Words
should be able to parse the reading
should split sentences into Japanese and English parts
should be able to parse multiple entries
should be able to read the file from disk
should be able to read the file in chunks
JLDrill::JWord
should have a kanji/reading key
JLDrill::JEDictionary
should be able to load a dictionary using the DataFile interface
JLDrill::Problem
should have a vocab associated with it
should give a string representation of the Kanji if it's there
should give a string representation of the Hint if it's there
should give a string representation of the Reading
should give a string representation of the Definitions
should have and empty string if the reading isn't set
should have and empty string if the definitions aren't set
should be able to assign a vocab
should create a ReadingProblem for level 0
should create a KanjiProblem for level 1
should create a MeaningProblem for level 2
should create a MeaningProblem for level 1 if there is no kanji
should create a ReadingProblem for unknown levels
should print the status correctly
JLDrill::ReadingProblem
should have a question of kanji, reading and hint and answer of definitions
should publish the correct items
should use the reading as kanji if there is no kanji
should publish the reading as kanji if there is no kanji
JLDrill::KanjiProblem
should have a question of kanji and answer of reading, definitions and hint
JLDrill::MeaningProblem
should have a question of definitions and answer of kanji, readings and hint
JLDrill::ProblemStatus
should react sanely when empty
should create a meaning problem if is starts parsing a schedule without a problem type
should create schedules for each problem type it recognizes
should output to save file format
should be able to clone
Browse Items - Edit an item from the vocabulary list
should be display all the vocabulary
should be able to edit one of the items
Time Limit Story - Review Set items have time limits
should start the thinkingTimer when a new problem is created
should stop the thinkingTimer when a problem is answered
should not have time limits on New Set Items
should not have time limits on Working Set Items
should not have time limits on newly promoted Review Set Items
should add a time limit after the first review
should be able to round the time limit to 3 decimals
should save the time limit to 3 decimals and read it back in
Can Input and Output Vocabularies - Special characters should be entered properly.
should handle quotes
should handle definition and marker lists with quotes
should handle returns
should handle definition and marker lists with returns
should handle commas
should be able to handle akeru
should be able to handle tojiru
should handle slashes
Edit a Problem - Delete the kanji in a KanjiProblem
should be able to generate a kanji problem
should redo the the problem if the Kanji is removed
Edit a Problem - Edit the problem to create a duplicate.
should not accept a duplicate vocabulary
should accept an altered vocabulary
JLDrill::Gtk::MainWindowView
should have a widget when initialized
should react to destroy signals
should have an icon
JLDrill::Gtk::StatisticsView
should close the view when the window is destroyed
JLDrill opens a file. - Gets the filename from the user
should automatically exit the context after entry
should destroy the selectorWindow when it closes
should set the filename and directory on OK
should not set the filename and directory on CANCEL
Pop up kanji info - The user is able to select popup kanji option
should have an entry in the menu
Quiz Status is Displayed - The DisplayQuizStatusContext is entered when the MainContext is entered
should have a DisplayQuizStatusContext
should enter the DisplayQuizStatusContext when the MainContext is entered
Quiz Status is Displayed - The DisplayQuizStatusContext is exited when the MainContext is exited
it should exit the DisplayQuizStatus Context when the MainContext is exited
Quiz Status is Displayed - There is a view that displays the status of the quiz
has a view
should add the view to bottom of the Gtk MainWindowView
displays the status of the quiz in the Gtk view
Quiz Status is Displayed - The view is updated whenever the status of the quiz changes
should update the status of the quiz when the context is entered
should receive updates when the quiz status changes
Each Problem Type has a Schedule - File stores the problem types
The problem types should have names
should be able to clone each of the problems
should print the name for to_s
JLDrill::ItemStatus
should be able to parse vocabulary from strings
should be able to set a lastReviewed time on the object
should be able to write the last reviewed time to file
should be able to parse the information in the file
should be able to write consecutive to file
should schedule new items to maximum value by default
should schedule old items to twice their elapsed time
should set a minimum schedule based on difficulty
should be able to write duration to file
should be able to parse the schedule information in the file
should be able to clear the schedule
should keep track of the number of times incorrect
should keep a difficulty level equal to the number of times it was incorrect the last time it was in the working set
should choose the longest interval with 0 difficulty
should decrement the interval by 20 percent from difficulty 1 to 5, down to 1 day
should decrement the interval from 1 day approaching 0 days as difficulty increases from 6
should be able to calculate the difficulty based on the interval that has passed.
should modify the difficulty when the item is correctly answered
should be able to tell if an item has duration in a range
should be able to show the reviewed date
Can Load Edict in EUC - Edict can determine the type
should be able to recognize utf8 and euc
Can Load Edict in EUC - Edict can parse EUC entries
should convert EUC data to UTF8
should be able to parse いってき
JLDrill::Kana
should be able to parse an entry from the kana file
should be able to parse entries with multiple romaji
should be able to create a string from the entry
should be able to parse a file in a string
should be able to parse a file on disk
Pop up kanji info - The user should see kana information
should load the kana info
should be able to find the kana items
User Loads Dictionary - You can load the reference from AddNewVocabulary
should load the reference when requested
User Loads Dictionary - You can load the reference from EditVocabulary
should load the reference when requested
User Loads Dictionary - The dictionary to load is in the save file.
should save the dictionary filename in the save file
should load the dictionary relative to the install directory
Problems are displayed - The DisplayProblemContext is entered when the MainContext is entered
should have a DisplayProblemContext
should enter the DisplayProblemContext when the app starts
Problems are displayed - The DisplayProblemContext is exited when the MainContext is exited
should exit the DisplayProblemContext when the MainContext is exited
Problems are displayed - There is a view that displays current Problem
The display should be updated when the application starts
should display a problem when a file is loaded
should refresh the display when the current vocab has been edited
should display each of the items in the problem
should have the correct text in the display
Problems are displayed - Embedded returns and quotes are displayed
has been tested in the Vocabulary spec
Problems are displayed - The ProblemView contains ItemHintsView.
notifies the ItemHintsView when there is a new problem
should notify the ItemHintsView when the problem is updated
Find the closest match - Find the number of common bytes
should return 0 for dissimilar strings
should count common characters at the beginning of the string
should return 0 for empty and nil strings
should work with UTF-8 characters
Find the closest match - Find the rank between two vocabs
should return 0 for nil objects
should return the number of common bytes in the reading
should use the kanji if it exists
should use the definitions
should use the markers
Vocabulary Is Stored In Items - Items can hold Vocabulary
should be able to create an Item from a Vocabulary
should be able to see if items are equal
User Adds Vocab To Quiz - The user enters AddNewVocabularyContext
should have an AddNewVocabularyContext
should enter the AddNewVocabularyContext when instructed
should have a view for a Vocabulary when the context is entered
should have a GTK view that allows editing of the Vocabulary
User Adds Vocab To Quiz - The user chooses to add the entered Vocabulary
should be able to add the view's Vocabulary to the Quiz
should not add invalid Vocabulary
should add the vocabulary to the parent context's quiz
should have a button on the Gtk window for adding the vocab
User Adds Vocab To Quiz - The fields in the view are cleared when a Vocabulary is added
should clear the fields in the Gtk window when an item has been added
should not clear the fields if the item was invalid
User Adds Vocab To Quiz - Doesn't add the same Vocabulary twice
it should refuse to add an item that already exists
User Adds Vocab To Quiz - The user can search the dictionary
can load the and search the dictionary from this context
User Chooses the Review Problem Types - Options are stored and read
should have the correct defaults
should store the default options
should store changed options
should show that the quiz needs saving if certain options are changed
should know if the review options have been set
should clear the review defaults when the reviewOptions are set
should create a list of allowed levels
User Chooses the Review Problem Types - Options view can modify options
should be able to set the review reading option
should be able to set the review kanji option
should be able to set the review meaning option
User Changes Options Story - Options are stored and read
should have the correct defaults
should store the default options
should store changed options
should show that the quiz needs saving if certain options are changed
shouldn't need to save if the options are changed to their current value
should load a file with different options
should be able to assign the options to another options object
User Changes Options Story - Options view can modify options
should destroy the options Window when it closes
should be able to run twice
should be able to set the Random Order option
should be able to set the Promote Threshold option
should be able to set the Intro Threshold option
Load Edict Entries on Demand - Can find an entry
should find an entry in a JEDictionary
should be able to find an entry in an EUC edict file
should be able to find an entries in a JEDictionary
Load Edict Entries on Demand - Extra Edict tests
should return nil from vocab() when index is out of range
should be able to load a Quiz from an Edict file
should be able to parse hacked JLPT files
Schedule Items Story - New items are scheduled from now
should schedule difficulty 0 items 5 days from now
should schedule new items from now even if there are scheduled items
should set a maximum of the duration * 2 + 25%
should schedule a minimum of the last duration
should vary the backoff depending on the previous duration
should be able to sort the review set items according to schedule
Context::Gtk::App
should start the Gtk main loop when run
should quit the Gtk main loop when quit
Context::Gtk::Widget
should keep track of the main Window