Sha256: fdafb1a3e5326afef4c447d5cfbeef7c2c8327419d2e3063e2a38d7cf701876d

Contents?: true

Size: 850 Bytes

Versions: 24

Compression:

Stored size: 850 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

class DraftTest < ActiveSupport::TestCase
  def test_restore
    issue = Issue.new(subject: 'some subject', description: 'some description')

    issue.save_draft
    restored_issue = RedmineCrm::ActsAsDraftable::Draft.find(issue.draft_id).restore

    assert_equal issue.subject, restored_issue.subject
    assert_equal issue.description, restored_issue.description
  end

  def test_restore_all
    first_issue = Issue.new(subject: 'first subject')
    first_issue.save_draft
    second_issue = Issue.new(subject: 'second subject')
    second_issue.save_draft

    restored_issues = RedmineCrm::ActsAsDraftable::Draft.restore_all
    assert_equal [first_issue.subject, second_issue.subject], restored_issues.map(&:subject).sort
  end

  private

  def current_user
    users(:sam)
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
redmine_crm-0.0.63 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.62 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.61 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.60 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.59 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.58 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.57 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.56 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.55 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.54 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.53 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.52 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.51 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.50 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.49 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.48 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.47 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.46 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.45 test/acts_as_draftable/draft_test.rb
redmine_crm-0.0.44 test/acts_as_draftable/draft_test.rb