UseCase "Helper methods"

From SMW CindyKate by dataspects
Component 158387
Jump to navigation Jump to search
[edit]
Keywords/Contexts

Rspec

Annotations
{{#compound_query:Component 158387Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.UseCaseMotivation;?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.UseCase "Helper methods";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.UseCase "Helper methods";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
name=MotivationsDeclaredOnThisPageResultItem|link=none}}
Motivations
Lua error in Module:Motivations at line 23: attempt to concatenate field 'hasReasoning' (a nil value).
[edit]

Content


MINIMIZE INDIRECTION! That means minimizing the cases in which you have to look elsewhere to understand something.

Re-use code within example groups describe() or context()

describe ... do
  def helper_method()
  end
  it
    helper_method()
  end
end
describe ... do
  def helper_method()
    yield object do
    end
  end
  it "idiom{{Footnote|Keep clean and consistent!"
    helper_method() do |yielded_object|
    end
  end
end

Sharing across example groups

module MyHelpers
  def ...
  end
end
describe ... do
  include MyHelpers
  it ... do
  end
end

OR

RSpec.configure do |config|
  config.include(MyHelpers)
end