Class: Crab::Story
- Inherits:
-
Object
- Object
- Crab::Story
- Defined in:
- lib/crab/story.rb
Constant Summary collapse
- VALID_STATES =
%w{Grooming Defined In-Progress Completed Accepted Released}
Instance Method Summary collapse
- #delete ⇒ Object
- #description ⇒ Object
- #file_name ⇒ Object
- #formatted_id ⇒ Object
- #full_file_name ⇒ Object
-
#initialize(rally_story, dry_run) ⇒ Story
constructor
A new instance of Story.
- #name ⇒ Object
- #rally_object ⇒ Object
- #scenarios ⇒ Object
- #state ⇒ Object
- #update(opts) ⇒ Object
Constructor Details
#initialize(rally_story, dry_run) ⇒ Story
Returns a new instance of Story.
7 8 9 10 |
# File 'lib/crab/story.rb', line 7 def initialize(rally_story, dry_run) @rally_story = rally_story @dry_run = dry_run end |
Instance Method Details
#delete ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/crab/story.rb', line 52 def delete if @dry_run puts "Would delete story #{formatted_id}" else @rally_story.delete end end |
#description ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/crab/story.rb', line 32 def description # this could use a lot of rethinking :( # biggest problem is that Cucumber breaks if text in description looks like something # it might know how to parse, but doesn't # our feature descriptions are quite like that, so I was being ultra-conservative sanitize(@rally_story.description || '').gsub(/ +/, "\n").gsub(/\n\n/, "\n").gsub(/\n/, "\n ") end |
#file_name ⇒ Object
16 17 18 |
# File 'lib/crab/story.rb', line 16 def file_name "#{formatted_id}-#{name.parameterize.dasherize}.feature" end |
#formatted_id ⇒ Object
24 25 26 |
# File 'lib/crab/story.rb', line 24 def formatted_id @rally_story.formatted_i_d end |
#full_file_name ⇒ Object
20 21 22 |
# File 'lib/crab/story.rb', line 20 def full_file_name "features/#{state}/#{file_name}" end |
#name ⇒ Object
12 13 14 |
# File 'lib/crab/story.rb', line 12 def name @rally_story.name end |
#rally_object ⇒ Object
60 61 62 |
# File 'lib/crab/story.rb', line 60 def rally_object @rally_story end |
#scenarios ⇒ Object
40 41 42 |
# File 'lib/crab/story.rb', line 40 def scenarios Array(@rally_story.test_cases).map {|tc| Crab::TestCase.new(tc, @dry_run) } end |
#state ⇒ Object
28 29 30 |
# File 'lib/crab/story.rb', line 28 def state (@rally_story.schedule_state || "unknown").parameterize.underscore end |
#update(opts) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/crab/story.rb', line 44 def update(opts) if @dry_run puts "Would update story #{formatted_id} with #{opts.inspect}" else @rally_story.update opts end end |