_merge_requests_status.html.haml_spec.rb 816 Bytes
Newer Older
1 2 3 4
# frozen_string_literal: true
require 'spec_helper'

describe 'projects/issues/_merge_requests_status.html.haml' do
5 6 7 8 9 10
  around do |ex|
    Timecop.freeze(Date.new(2018, 7, 22)) do
      ex.run
    end
  end

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  it 'shows date of status change in tooltip' do
    merge_request = create(:merge_request, created_at: 1.month.ago)

    render partial: 'projects/issues/merge_requests_status',
           locals: { merge_request: merge_request, css_class: '' }

    expect(rendered).to match("Opened.*about 1 month ago")
  end

  it 'shows only status in tooltip if date is not set' do
    merge_request = create(:merge_request, state: :closed)

    render partial: 'projects/issues/merge_requests_status',
           locals: { merge_request: merge_request, css_class: '' }

    expect(rendered).to match("Closed")
  end
end