Module: TDriver::FixtureSetupFunctions
- Defined in:
- lib/tdriver/util/fixture/service.rb
Overview
FixturePluginService
Instance Method Summary collapse
Instance Method Details
#[](name) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/tdriver/util/fixture/service.rb', line 106 def []( name ) name.check_type [ String, Symbol ], 'wrong argument type $1 for fixture name (expected $2)' @target.parameter[ :fixtures ].fetch( name.to_sym ){ | name | raise MobyBase::BehaviourError.new( "Fixture", "Failed to execute fixture due to #{ name.to_s.inspect } not found for #{ @target.sut.id.inspect }" ) } end |
#[]=(name, plugin) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/tdriver/util/fixture/service.rb', line 118 def []=( name, plugin ) name.check_type [ String, Symbol ], 'wrong argument type $1 for fixture name (expected $2)' plugin.check_type [ String ], 'wrong argument type $1 for fixture pluin name (expected $2)' name = name.to_sym plugin = plugin.to_s # create fixtures configuration hash unless already exists @target.parameter[ :fixtures ] = {} unless @target.parameter.has_key?( :fixtures ) if @target.parameter[ :fixtures ].has_key?( name ) # retrieve existing fixture configuration fixture_hash = @target.parameter[ :fixtures ][ name ] else # fixture was not found from hash, add sut environment to hash fixture_hash = { :env => @target.instance_variable_get(:@environment) } end # store plugin name to hash fixture_hash[ :plugin ] = plugin # store fixture settings to fixtures configuration hash @target.parameter[ :fixtures ][ name ] = fixture_hash self end |