Class: ObjcSuite

Inherits:
Suite show all
Defined in:
lib/ObjC/objc_suite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Suite

#all_feature_files, #all_feature_files_as_strings, #html, #open_in_safari, #parse, #parse_feature_scenarios, #parse_output_file_and_open_in_browser, #parse_results, #parse_results_and_open_in_safari, #passed?, #run, #unique_feature_test_case_names?, #valid?

Constructor Details

#initialize(hash) ⇒ ObjcSuite

Returns a new instance of ObjcSuite.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ObjC/objc_suite.rb', line 10

def initialize(hash)
  @feature_files_path          = hash[:feature_files_path]
  @feature_file_suffix         = hash[:feature_file_suffix] || "feature"
  @test_cases_file             = hash[:test_cases_file]
  @feature_class_header_files  = hash[:feature_class_header_files] || ["OMFeature.h"]
  @feature_keyword             = hash[:feature_keyword] || "Feature:"
  @scenario_keyword            = hash[:scenario_keyword] || "Scenario:"
  @given_scenario_keyword      = hash[:given_scenario_keyword] || "GivenScenario:"
  @project_name                = hash[:project_name] || "Features"
  @follow_up_keyword           = hash[:follow_up_keyword] || "And"
  @feature_files               = all_feature_files
  @feature_files_as_strings    = all_feature_files_as_strings
end

Instance Attribute Details

#feature_class_header_filesObject (readonly)

Returns the value of attribute feature_class_header_files.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def feature_class_header_files
  @feature_class_header_files
end

#feature_file_suffixObject (readonly)

Returns the value of attribute feature_file_suffix.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def feature_file_suffix
  @feature_file_suffix
end

#feature_filesObject (readonly)

Returns the value of attribute feature_files.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def feature_files
  @feature_files
end

#feature_files_as_stringsObject (readonly)

Returns the value of attribute feature_files_as_strings.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def feature_files_as_strings
  @feature_files_as_strings
end

#feature_files_pathObject (readonly)

Returns the value of attribute feature_files_path.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def feature_files_path
  @feature_files_path
end

#feature_keywordObject (readonly)

Returns the value of attribute feature_keyword.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def feature_keyword
  @feature_keyword
end

#featuresObject (readonly)

Returns the value of attribute features.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def features
  @features
end

#follow_up_keywordObject (readonly)

Returns the value of attribute follow_up_keyword.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def follow_up_keyword
  @follow_up_keyword
end

#given_scenario_keywordObject (readonly)

Returns the value of attribute given_scenario_keyword.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def given_scenario_keyword
  @given_scenario_keyword
end

#passedObject (readonly)

Returns the value of attribute passed.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def passed
  @passed
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def project_name
  @project_name
end

#scenario_keywordObject (readonly)

Returns the value of attribute scenario_keyword.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def scenario_keyword
  @scenario_keyword
end

#test_cases_fileObject (readonly)

Returns the value of attribute test_cases_file.



2
3
4
# File 'lib/ObjC/objc_suite.rb', line 2

def test_cases_file
  @test_cases_file
end

Instance Method Details

#parse_features(klass = ObjcFeature) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ObjC/objc_suite.rb', line 24

def parse_features(klass=ObjcFeature)
  title_body_arr = Parser.title_and_body_by_keyword_from_string({
    :string => feature_files_as_strings.join(" "),
    :keyword => feature_keyword
  })
  @features = title_body_arr.map do |hash| 
    klass.new(hash.update({
      :keyword => feature_keyword, 
      :scenario_keyword => scenario_keyword,
      :given_scenario_keyword => given_scenario_keyword,
      :follow_up_keyword => follow_up_keyword}))
  end
end

#to_sObject



38
39
40
41
42
43
# File 'lib/ObjC/objc_suite.rb', line 38

def to_s
  <<-END
  #{feature_class_header_files.map { |f| "#import \"" + f + "\"" }.join(" ")}
  #{features.map {|f| f.to_s }.join(" ")}
  END
end