Class: RSpec::Fire::FireClassDouble
- Inherits:
-
Module
- Object
- Module
- RSpec::Fire::FireClassDouble
- Includes:
- FireDoublable
- Defined in:
- lib/rspec/fire/legacy.rb
Defined Under Namespace
Modules: AsReplacedConstant, StringRepresentations
Instance Method Summary collapse
- #as_replaced_constant(*args) ⇒ Object
- #as_stubbed_const(options = {}) ⇒ Object
-
#initialize(doubled_class, stubs = {}) ⇒ FireClassDouble
constructor
A new instance of FireClassDouble.
- #name ⇒ Object
Methods included from FireDoublable
#should_not_receive, #should_receive, #stub, #stub!, #with_doubled_class
Methods included from RecursiveConstMethods
#const_defined_on?, #get_const_defined_on, #recursive_const_defined?, #recursive_const_get
Constructor Details
#initialize(doubled_class, stubs = {}) ⇒ FireClassDouble
Returns a new instance of FireClassDouble.
261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/rspec/fire/legacy.rb', line 261 def initialize(doubled_class, stubs = {}) @__doubled_class_name = doubled_class @__checked_methods = :public_methods @__method_finder = :method verify_constant_name if RSpec::Fire.configuration.verify_constant_names? ::RSpec::Mocks::TestDouble.extend_onto self, doubled_class, stubs.merge(:__declared_as => "FireClassDouble") # This needs to come after `::RSpec::Mocks::TestDouble.extend_onto` # so that it gets precedence... extend StringRepresentations end |
Instance Method Details
#as_replaced_constant(*args) ⇒ Object
284 285 286 287 |
# File 'lib/rspec/fire/legacy.rb', line 284 def as_replaced_constant(*args) RSpec::Fire::DEPRECATED["as_replaced_constant is deprecated, use as_stubbed_const instead."] as_stubbed_const(*args) end |
#as_stubbed_const(options = {}) ⇒ Object
276 277 278 279 280 281 282 |
# File 'lib/rspec/fire/legacy.rb', line 276 def as_stubbed_const( = {}) RSpec::Mocks::ConstantStubber.stub(@__doubled_class_name, self, ) @__original_class = RSpec::Mocks::Constant.original(@__doubled_class_name).original_value extend AsReplacedConstant self end |
#name ⇒ Object
289 290 291 |
# File 'lib/rspec/fire/legacy.rb', line 289 def name @__doubled_class_name end |