Class: TDriver::FixtureService
- Defined in:
- lib/tdriver/util/fixture/service.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FixtureService
constructor
TODO: document me.
- #method_missing(name, arguments = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FixtureService
TODO: document me
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/tdriver/util/fixture/service.rb', line 165 def initialize( = {} ) # verify that options is type of hash .check_type Hash, 'wrong argument type $1 for fixture service options (expected $2)' # verify that target object is defined in options hash .require_key :target # store given options @options = # store sut variable @target = [ :target ] # store caller backtrace @caller = caller # extend with fixture setup functions if self is kind of sut extend FixtureSetupFunctions if @target.sut? self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, arguments = {}) ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/tdriver/util/fixture/service.rb', line 189 def method_missing( name, arguments = {} ) arguments.check_type Hash, 'wrong argument type $1 for fixture options (expected $2)' _fixtures = $parameters[ @target.sut.id ][ :fixtures, {} ] if _fixtures.has_key?( name ) FixturePluginService.new( :target => @target, :name => name, :arguments => arguments, :configuration => _fixtures[ name ] ) else $logger.behaviour "FAIL;Failed to execute fixture due to #{ name.inspect } not foudn for #{ @target.sut.id.inspect }.;#{ @target.id.to_s };sut;{};fixture;" raise MobyBase::BehaviourError.new( "Fixture", "Failed to execute fixture due to #{ name.to_s.inspect } not found for #{ @target.sut.id.inspect }" ) end end |