Skip to content

Commit 7d03cfd

Browse files
committed
More test fixes
1 parent df2f88d commit 7d03cfd

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed

app/models/cms/abstract_file_block.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class AbstractFileBlock < ActiveRecord::Base
44

55
def self.with_parent_id(parent_id)
66
if parent_id == 'all'
7-
where(true) # Empty scope for chaining
7+
self.all # Empty scope for chaining
88
else
99
self.includes({:attachments => :section_node})
1010
.references(:section_node)

lib/cms/behaviors/attaching.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ def validates_attachment_size(name, options = {})
8787
def validates_attachment_presence(name, options = {})
8888
message = options[:message] || "Must provide at least one #{name}"
8989
validate do |record|
90-
return if record.deleted?
91-
unless record.attachments.any? { |a| a.attachment_name == name.to_s }
92-
record.errors.add(:attachment, message)
90+
if !record.deleted?
91+
unless record.attachments.any? { |a| a.attachment_name == name.to_s }
92+
record.errors.add(:attachment, message)
93+
end
9394
end
9495
end
9596
end

lib/cms/behaviors/versioning.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ def version_comment
345345
def version_comment=(version_comment)
346346
@version_comment = version_comment
347347
#send(:changed_attributes)["version_comment"] = @version_comment
348+
#attr_name = "version_comment"
349+
#self.send("#{attr_name}_will_change!")
350+
#self.version_comment = @version_comment
348351
end
349352

350353
def different_from_last_draft?

spec/cms/email_message_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
describe "#absolute_cms_url" do
1313
it "should return a url which points to the cms admin version of a page" do
14-
Rails.configuration.cms.expects(:site_domain).returns('www.example.com')
14+
Rails.configuration.cms.expects(:site_domain).retu rns('www.example.com')
1515
url = Cms::EmailMessage.absolute_cms_url("/some-path")
1616
url.must_equal "http://cms.example.com/some-path"
1717
end

test/unit/helpers/application_helper_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Cms::ApplicationHelper::EditButtonTest < ActionView::TestCase
4646
# Scenario: Edit Buttons should:
4747

4848
test "generate a button without an explicit title by default" do
49-
expected_html = '<a class="button disabled" href="#" id="edit_button"><span>&nbsp;Edit&nbsp;</span></a>'
49+
expected_html = '<a id="edit_button" class="button disabled" href="#"><span>&nbsp;Edit&nbsp;</span></a>'
5050
assert_equal expected_html, edit_button
5151
end
5252

test/unit/models/file_block_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_table_name
6666
@file_block.save!
6767
assert_not_nil @file_block.file
6868

69-
found = Cms::FileBlock.find(@file_block)
69+
found = Cms::FileBlock.find(@file_block.id)
7070
assert_not_nil found.file
7171
end
7272

test/unit/models/html_block_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ class HtmlBlockTest < ActiveSupport::TestCase
1010
blue = create(:html_block, name: 'blue')
1111

1212
results = Cms::HtmlBlock.paginate(page: 1, per_page: 1)
13+
14+
puts "this is red"
15+
puts red
16+
puts "this is results"
17+
puts results.first
18+
puts ""
1319
assert_equal 1, results.size
1420
assert_equal red, results.first
1521
end

test/unit/portlets/list_portlet_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.join(File.dirname(__FILE__), '/../../test_helper')
1+
require 'test_helper'
22

33
class ListTest < ActiveSupport::TestCase
44

0 commit comments

Comments
 (0)