Sha256: 9ad47acfa9832e74b53b5a6948229e6a0db863ee76c16ee6b70a02541693dede

Contents?: true

Size: 1022 Bytes

Versions: 3

Compression:

Stored size: 1022 Bytes

Contents

class ObjcFeature < Feature
  def parse_scenarios(klass=ObjcScenario)
    title_body_arr = Parser.title_and_body_by_keyword_from_string({
      :string => body,
      :keyword => scenario_keyword
    })
    @scenarios = title_body_arr.map {|hash| klass.new(hash.update({
      :parent => self,
      :given_scenario_keyword => given_scenario_keyword,
      :follow_up_keyword => follow_up_keyword
    }))}
    @scenarios.each {|scenario| scenario.collect_steps}
    self
  end
  
  def to_s
    <<-END
    @interface #{test_case_name} : OMFeature
    @end
    @implementation #{test_case_name}
    #{scenarios.map {|s| s.to_s}.join(" ")}
    @end
    END
  end
  
  def to_html
    <<-END
    <div class="feature">
      <h2 class="feature_title">#{keyword} #{title}</h2>
      <p class="story">
        #{story_html}
      </p>
      #{scenarios.map {|s| s.to_html }.join(" \n")}
    </div>
  END
  end
  
  def test_case_name
    "#{title.remove_invalid_chars.split(/\s+/).map {|w| w.capitalize}.join('')}Test"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
features-0.3.0 lib/ObjC/objc_feature.rb
features-0.2.1 lib/ObjC/objc_feature.rb
features-0.2.0 lib/ObjC/objc_feature.rb