class Tset::Translators::Rspec
Translates testable to an RSpec test
@param testable [Test::Testable] An instance of testable
Constants
- MODEL_TRANSLATION_RULES
Attributes
testable[R]
Public Class Methods
new(testable)
click to toggle source
# File lib/tset/translators/rspec.rb, line 37 def initialize(testable) @testable = testable end
Public Instance Methods
start()
click to toggle source
@return [Tset::Test] An object containing RSpec test corresponding to the testable and category
# File lib/tset/translators/rspec.rb, line 44 def start send("translate_#{ testable.type }") end
Private Instance Methods
translate_model()
click to toggle source
Translates the testable from the object using MODEL_TRANSLATION_RULES
@return [Tset::Test] an object containing corresponding test_code and category
# File lib/tset/translators/rspec.rb, line 55 def translate_model MODEL_TRANSLATION_RULES.each do |rule| rule.values.first.each do |pattern, outcome| if testable.code =~ pattern test_code = outcome % [$1, $2] return Tset::Test.new(test_code, rule.keys.first) end end end end