Merge branch 'feature/rails3_fix_issue_description_diff' into feature/rails3

Conflicts:
	spec/lib/journal_formatter/attachment_spec.rb
	spec/lib/journal_formatter/diff_spec.rb
pull/129/merge
jwollert 12 years ago
commit be78673459
  1. 2
      lib/open_project/journal_formatter/attachment.rb
  2. 8
      spec/lib/journal_formatter/attachment_spec.rb
  3. 8
      spec/lib/journal_formatter/diff_spec.rb

@ -33,7 +33,7 @@ class OpenProject::JournalFormatter::Attachment < ::JournalFormatter::Base
def format_html_attachment_detail(key, value) def format_html_attachment_detail(key, value)
if !value.blank? && a = Attachment.find_by_id(key.to_i) if !value.blank? && a = Attachment.find_by_id(key.to_i)
link_to_attachment(a, :only_path => false ) link_to_attachment(a, :only_path => true )
else else
value if value.present? value if value.present?
end end

@ -41,12 +41,12 @@ describe OpenProject::JournalFormatter::Attachment do
#it { instance.render(key, [nil, attachment.id.to_s]).should == expected } #it { instance.render(key, [nil, attachment.id.to_s]).should == expected }
# #
# Setting value by hand is just a workaround until rspec bug is fixed # Setting value by hand is just a workaround until rspec bug is fixed
it { instance.render(key, [nil, attachment.id.to_s]).should == I18n.t(:text_journal_added, :label => "<strong>#{I18n.t(:label_attachment)}</strong>", :value => "<a href=\"/attachments/#{attachment.id}/#{attachment.filename}\">#{attachment.filename}</a>") } it { instance.render(key, [nil, attachment.id.to_s]).should == I18n.t(:text_journal_added, :label => "<strong>#{I18n.t(:'activerecord.models.attachment')}</strong>", :value => "<a href=\"/attachments/#{attachment.id}/#{attachment.filename}\">#{attachment.filename}</a>") }
end end
describe "WITH the first value beeing an id as string, and the second nil" do describe "WITH the first value beeing an id as string, and the second nil" do
let(:expected) { I18n.t(:text_journal_deleted, let(:expected) { I18n.t(:text_journal_deleted,
:label => "<strong>#{I18n.t(:label_attachment)}</strong>", :label => "<strong>#{I18n.t(:'activerecord.models.attachment')}</strong>",
:old => "<strike><i>#{attachment.id}</i></strike>") } :old => "<strike><i>#{attachment.id}</i></strike>") }
it { instance.render(key, [attachment.id.to_s, nil]).should == expected } it { instance.render(key, [attachment.id.to_s, nil]).should == expected }
@ -55,7 +55,7 @@ describe OpenProject::JournalFormatter::Attachment do
describe "WITH the first value beeing nil, and the second an id as a string describe "WITH the first value beeing nil, and the second an id as a string
WITH specifying not to output html" do WITH specifying not to output html" do
let(:expected) { I18n.t(:text_journal_added, let(:expected) { I18n.t(:text_journal_added,
:label => I18n.t(:label_attachment), :label => I18n.t(:'activerecord.models.attachment'),
:value => attachment.id) } :value => attachment.id) }
it { instance.render(key, [nil, attachment.id.to_s], :no_html => true).should == expected } it { instance.render(key, [nil, attachment.id.to_s], :no_html => true).should == expected }
@ -64,7 +64,7 @@ describe OpenProject::JournalFormatter::Attachment do
describe "WITH the first value beeing an id as string, and the second nil, describe "WITH the first value beeing an id as string, and the second nil,
WITH specifying not to output html" do WITH specifying not to output html" do
let(:expected) { I18n.t(:text_journal_deleted, let(:expected) { I18n.t(:text_journal_deleted,
:label => I18n.t(:label_attachment), :label => I18n.t(:'activerecord.models.attachment'),
:old => attachment.id) } :old => attachment.id) }
it { instance.render(key, [attachment.id.to_s, nil], :no_html => true).should == expected } it { instance.render(key, [attachment.id.to_s, nil], :no_html => true).should == expected }

@ -8,12 +8,20 @@ describe OpenProject::JournalFormatter::Diff do
include ActionView::Helpers::UrlHelper include ActionView::Helpers::UrlHelper
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
<<<<<<< HEAD
Struct.new("TestJournal", :id) Struct.new("TestJournal", :id)
=======
Struct.new("TestJournal", :id, :journaled)
>>>>>>> feature/rails3_fix_issue_description_diff
let(:klass) { OpenProject::JournalFormatter::Diff } let(:klass) { OpenProject::JournalFormatter::Diff }
let(:id) { 1 } let(:id) { 1 }
let(:journal) do let(:journal) do
<<<<<<< HEAD
Struct::TestJournal.new(id) Struct::TestJournal.new(id)
=======
Struct::TestJournal.new(id, Issue.new)
>>>>>>> feature/rails3_fix_issue_description_diff
end end
let(:instance) { klass.new(journal) } let(:instance) { klass.new(journal) }
let(:key) { "description" } let(:key) { "description" }

Loading…
Cancel
Save