Class: RSpec::ApiGen::Fixture
- Inherits:
-
Object
- Object
- RSpec::ApiGen::Fixture
- Defined in:
- lib/rspec-apigen/fixture.rb
Instance Attribute Summary collapse
-
#create_proc ⇒ Object
readonly
Returns the value of attribute create_proc.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#destroy_proc ⇒ Object
readonly
Returns the value of attribute destroy_proc.
Instance Method Summary collapse
- #create(&block) ⇒ Object
- #destroy(&block) ⇒ Object
-
#initialize(description, &block) ⇒ Fixture
constructor
def initialize(description, create_proc, destroy_proc = nil).
Constructor Details
#initialize(description, &block) ⇒ Fixture
def initialize(description, create_proc, destroy_proc = nil)
8 9 10 11 12 13 |
# File 'lib/rspec-apigen/fixture.rb', line 8 def initialize(description, &block) @description = description && "" # initialize this instance self.instance_eval &block end |
Instance Attribute Details
#create_proc ⇒ Object (readonly)
Returns the value of attribute create_proc.
4 5 6 |
# File 'lib/rspec-apigen/fixture.rb', line 4 def create_proc @create_proc end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/rspec-apigen/fixture.rb', line 3 def description @description end |
#destroy_proc ⇒ Object (readonly)
Returns the value of attribute destroy_proc.
5 6 7 |
# File 'lib/rspec-apigen/fixture.rb', line 5 def destroy_proc @destroy_proc end |
Instance Method Details
#create(&block) ⇒ Object
15 16 17 |
# File 'lib/rspec-apigen/fixture.rb', line 15 def create(&block) block.nil? ? @create_proc.call : @create_proc = block end |
#destroy(&block) ⇒ Object
19 20 21 |
# File 'lib/rspec-apigen/fixture.rb', line 19 def destroy(&block) block.nil? ? @destroy_proc.call : @destroy_proc = block end |