ee/spec/models/burndown_spec.rb
# Creates, closes and reopens issues only for odd days numbers
Creates, closes and reopens issues only for odd days numbers
Creates closes and reopens issues only for odd days numbers
def build_sample(milestone, issue_params)
    milestone.start_date.upto(milestone.due_date) do |date|
      day = date.day
      next if day.even?
      count = day
      Timecop.travel(date) do
        issues = create_list(:issue, count, issue_params)
        issues.each do |issue|
          Event.create!(author: user,
                        target: issue,
                        created_at: Date.yesterday,
                        action: Event::CREATED)
        end
        closed = issues.slice(0..count / 2)
        closed.each { |issue| close_issue(issue) }
        reopened_issues = closed.slice(0..count / 4)
        reopened_issues.each { |issue| reopen_issue(issue) }
        issue_closed_twice = reopened_issues.last
        close_issue(issue_closed_twice)
        reopen_issue(issue_closed_twice)
      end
    end
  end
def build_sample ( milestone , issue_params ) milestone . start_date . upto ( milestone . due_date ) do | date | day = date . day next if day . even? count = day Timecop . travel ( date ) do issues = create_list ( :issue , count , issue_params ) issues . each do | issue | Event . create! ( author : user , target : issue , created_at : Date . yesterday , action : Event :: CREATED ) end closed = issues . slice ( 0 .. count / 2 ) closed . each { | issue | close_issue ( issue ) } reopened_issues = closed . slice ( 0 .. count / 4 ) reopened_issues . each { | issue | reopen_issue ( issue ) } issue_closed_twice = reopened_issues . last close_issue ( issue_closed_twice ) reopen_issue ( issue_closed_twice ) end end end
Creates, closes and reopens issues only for odd days numbers
Creates closes and reopens issues only for odd days numbers
# Create issues # Turns out we need to make sure older events that are not "closed" # won't be caught by the query. # Close issues # Reopen issues # This generates an issue with multiple closing events
milestone
<not_specific>
issue_params
<not_specific>