Merge pull request #16 from tgsoverly/dev

pull/6827/head
Hagen Schink 11 years ago
commit 01437b8889
  1. 25
      README.md
  2. 1
      app/models/document.rb
  3. 2
      doc/CHANGELOG.md
  4. 7
      spec/models/document_spec.rb

@ -39,6 +39,31 @@ This plugin contains migrations. To migrate the database, run:
`rake db:migrate`
Tests
-----
Assuming you have to following directory structure:
```
.
├── openproject
├── openproject-documents
```
Replace the openproject-document ``gemfile.plugins`` entry with the following:
```
gem "openproject-documents", path: "../openproject-documents"
```
You run the specs with the following commands:
```
cd openproject
rake db:test:load # this needs to be done only once
rspec ../openproject-documents
```
Deinstallation
--------------

@ -39,6 +39,7 @@ class Document < ActiveRecord::Base
acts_as_journalized
acts_as_event title: Proc.new { |o| "#{Document.model_name.human}: #{o.title}" },
url: Proc.new { |o| { controller: '/documents', action: 'show', id: o.id } },
datetime: :created_on,
author: ( Proc.new do |o|
o.attachments.find(:first, order: "#{Attachment.table_name}.created_on ASC").try(:author)
end)

@ -32,6 +32,8 @@ See doc/COPYRIGHT.rdoc for more details.
# Changelog
* Fix: Acts as event datetime
## 1.0.1
* `#5361` Add missing journal data migration

@ -101,4 +101,11 @@ describe Document do
end
end
describe "acts as event" do
let(:now) { Time.now }
let(:document) { FactoryGirl.build(:document,
created_on: now) }
it { expect(document.event_datetime).to eq(now) }
end
end

Loading…
Cancel
Save