class Tset::Testable

Snippet of code that can be converted to a test by Writers

@param type [String] The part of application from which the code originate (e.g. controller, model) @param code [String] The testable code itself

Constants

TRANSLATOR_NAMESPACE

Attributes

code[R]
type[R]

Public Class Methods

new(type, code) click to toggle source
# File lib/tset/testable.rb, line 18
def initialize(type, code)
  @type = type
  @code = code
end

Public Instance Methods

to_test(framework = 'rspec') click to toggle source
# File lib/tset/testable.rb, line 23
def to_test(framework = 'rspec')
  translator(framework).start
end

Private Instance Methods

translator(framework) click to toggle source
# File lib/tset/testable.rb, line 29
def translator(framework)
  class_name = framework.classify
  Object.const_get(TRANSLATOR_NAMESPACE % class_name).new(self)
end