Support Ruby 2.4.

This commit is contained in:
Guo Xiang Tan
2017-04-15 12:11:02 +08:00
parent 86efc57390
commit 04016f0dec
29 changed files with 73 additions and 60 deletions

View File

@@ -297,6 +297,8 @@ describe Email::Receiver do
end
it "supports attached images" do
SiteSetting.queue_jobs = true
expect { process(:no_body_with_image) }.to change { topic.posts.count }
expect(topic.posts.last.raw).to match(/<img/)

View File

@@ -28,6 +28,7 @@ LONG_COOKED
end
it 'autolinks' do
stub_request(:get, "https://www.eviltrout.com").to_return(body: "")
expect(EmailCook.new("https://www.eviltrout.com").cook).to eq("<a href='https://www.eviltrout.com'>https://www.eviltrout.com</a><br>")
end

View File

@@ -71,7 +71,7 @@ describe Onebox::Engine::DiscourseLocalOnebox do
it "returns nil if file type is not audio or video" do
url = "#{Discourse.base_url}#{path}.pdf"
FakeWeb.register_uri(:get, url, body: "")
stub_request(:get, url).to_return(body: '')
expect(Onebox.preview(url).to_s).to eq("")
end

View File

@@ -4,9 +4,10 @@ require_dependency 'oneboxer'
describe Oneboxer do
it "returns blank string for an invalid onebox" do
stub_request(:get, "http://boom.com").to_return(body: "")
expect(Oneboxer.preview("http://boom.com")).to eq("")
expect(Oneboxer.onebox("http://boom.com")).to eq("")
end
end

View File

@@ -255,6 +255,8 @@ describe PostCreator do
it 'creates a post with featured link' do
SiteSetting.topic_featured_link_enabled = true
SiteSetting.min_first_post_length = 100
SiteSetting.queue_jobs = true
post = creator_with_featured_link.create
expect(post.topic.featured_link).to eq('http://www.discourse.org')
expect(post.valid?).to eq(true)
@@ -585,7 +587,7 @@ describe PostCreator do
it 'acts correctly' do
# It's not a warning
expect(post.topic.warning).to be_blank
expect(post.topic.user_warning).to be_blank
expect(post.topic.archetype).to eq(Archetype.private_message)
expect(post.topic.subtype).to eq(TopicSubtype.user_to_user)
@@ -657,11 +659,11 @@ describe PostCreator do
topic = post.topic
expect(topic).to be_present
expect(topic.warning).to be_present
expect(topic.user_warning).to be_present
expect(topic.subtype).to eq(TopicSubtype.moderator_warning)
expect(topic.warning.user).to eq(target_user1)
expect(topic.warning.created_by).to eq(user)
expect(target_user1.warnings.count).to eq(1)
expect(topic.user_warning.user).to eq(target_user1)
expect(topic.user_warning.created_by).to eq(user)
expect(target_user1.user_warnings.count).to eq(1)
end
end

View File

@@ -58,7 +58,7 @@ describe SiteSettingExtension do
settings.hello = 100
expect(settings.hello).to eq(100)
settings.provider.save(:hello, 99, SiteSetting.types[:fixnum] )
settings.provider.save(:hello, 99, SiteSetting.types[:integer] )
settings.refresh!
expect(settings.hello).to eq(99)
@@ -386,16 +386,6 @@ describe SiteSettingExtension do
end
end
describe "set for an invalid fixnum value" do
it "raises an error" do
settings.setting(:test_setting, 80)
settings.refresh!
expect {
settings.set("test_setting", 9999999999999999999)
}.to raise_error(ArgumentError)
end
end
describe "filter domain name" do
before do
settings.setting(:white_listed_spam_host_domains, "www.example.com")