Class: Crab::CucumberToRallyAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/crab/cucumber_to_rally_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature_text, feature_file) ⇒ CucumberToRallyAdapter

Returns a new instance of CucumberToRallyAdapter.



3
4
5
6
7
8
9
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 3

def initialize(feature_text, feature_file)
  @scenarios = []
  @steps = ActiveSupport::OrderedHash.new []

  parser = Gherkin::Parser::Parser.new(self, false, "root", false)
  parser.parse feature_text, feature_file, 0
end

Instance Attribute Details

#scenariosObject (readonly)

Returns the value of attribute scenarios.



11
12
13
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 11

def scenarios
  @scenarios
end

#stepsObject (readonly)

Returns the value of attribute steps.



11
12
13
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 11

def steps
  @steps
end

Instance Method Details

#descriptionObject



24
25
26
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 24

def description
  @feature.description.gsub(/^\n/, '')
end

#eofObject



45
46
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 45

def eof
end

#feature(feature) ⇒ Object



33
34
35
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 33

def feature(feature)
  @feature = feature
end

#nameObject



19
20
21
22
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 19

def name
  @feature.name.match(/^\[([^\]]+)\](.*)$/)
  $2.strip
end

#scenario(scenario) ⇒ Object



37
38
39
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 37

def scenario(scenario)
  @scenarios << scenario
end

#step(step) ⇒ Object



41
42
43
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 41

def step(step)
  @steps[@scenarios.last] += Array(step)
end

#story_idObject

Rally compat



14
15
16
17
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 14

def story_id
  @feature.name.match(/^\[([^\]]+)\](.*)$/)
  $1.strip
end

#uri(uri) ⇒ Object

Cucumber compat



29
30
31
# File 'lib/crab/cucumber_to_rally_adapter.rb', line 29

def uri(uri)
  @uri
end