Merge pull request #6747 from cmrd-senya/rspec-fixup
Fix usage of hard-coded pod URI in rspec testsuite
This commit is contained in:
commit
a414fb2381
4 changed files with 19 additions and 8 deletions
|
|
@ -32,7 +32,7 @@ describe PostsHelper, :type => :helper do
|
|||
end
|
||||
|
||||
it "returns an iframe containing the post" do
|
||||
expect(post_iframe_url(@post.id)).to include "src='http://localhost:9887#{post_path(@post)}'"
|
||||
expect(post_iframe_url(@post.id)).to include "src='#{AppConfig.url_to(post_path(@post))}'"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Diaspora::Markdownify::Email do
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
describe '#preprocess' do
|
||||
before do
|
||||
@html = Diaspora::Markdownify::Email.new
|
||||
|
|
@ -8,12 +10,14 @@ describe Diaspora::Markdownify::Email do
|
|||
|
||||
it 'should autolink a hashtag' do
|
||||
markdownified = @html.preprocess("#tag")
|
||||
expect(markdownified).to eq("[#tag](http://localhost:9887/tags/tag)")
|
||||
expect(markdownified).to eq("[#tag](#{AppConfig.url_to(tag_path('tag'))})")
|
||||
end
|
||||
|
||||
it 'should autolink multiple hashtags' do
|
||||
markdownified = @html.preprocess("oh #l #loL")
|
||||
expect(markdownified).to eq("oh [#l](http://localhost:9887/tags/l) [#loL](http://localhost:9887/tags/lol)")
|
||||
expect(markdownified).to eq(
|
||||
"oh [#l](#{AppConfig.url_to(tag_path('l'))}) [#loL](#{AppConfig.url_to(tag_path('lol'))})"
|
||||
)
|
||||
end
|
||||
|
||||
it 'should not autolink headers' do
|
||||
|
|
@ -30,7 +34,10 @@ describe Diaspora::Markdownify::Email do
|
|||
|
||||
it 'should render the message' do
|
||||
rendered = @markdown.render(@sample_text).strip
|
||||
expect(rendered).to eq("<h1>Header</h1>\n\n<p><a href=\"http://localhost:9887/tags/messages\">#messages</a> containing <a href=\"http://localhost:9887/tags/hashtags\">#hashtags</a> should render properly</p>")
|
||||
expect(rendered).to eq(
|
||||
"<h1>Header</h1>\n\n<p><a href=\"#{AppConfig.url_to(tag_path('messages'))}\">#messages</a>\
|
||||
containing <a href=\"#{AppConfig.url_to(tag_path('hashtags'))}\">#hashtags</a> should render properly</p>"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
require "spec_helper"
|
||||
|
||||
describe Diaspora::Taggable do
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
describe "#format_tags" do
|
||||
context "when there are no tags in the text" do
|
||||
it "returns the input text" do
|
||||
|
|
@ -40,19 +42,19 @@ describe Diaspora::Taggable do
|
|||
context "when there is a tag in the text" do
|
||||
it "autolinks and normalizes the hashtag" do
|
||||
text = Diaspora::Taggable.format_tags_for_mail("There is a #hashTag.")
|
||||
expect(text).to eq("There is a [#hashTag](http://localhost:9887/tags/hashtag).")
|
||||
expect(text).to eq("There is a [#hashTag](#{AppConfig.url_to(tag_path('hashtag'))}).")
|
||||
end
|
||||
|
||||
it "autolinks #<3" do
|
||||
text = Diaspora::Taggable.format_tags_for_mail("#<3")
|
||||
expect(text).to eq("[#<3](http://localhost:9887/tags/%3C3)")
|
||||
expect(text).to eq("[#<3](#{AppConfig.url_to(tag_path('<3'))})")
|
||||
end
|
||||
end
|
||||
|
||||
context "with multiple tags" do
|
||||
it "autolinks the hashtags" do
|
||||
text = Diaspora::Taggable.format_tags_for_mail("#l #lol")
|
||||
expect(text).to eq("[#l](http://localhost:9887/tags/l) [#lol](http://localhost:9887/tags/lol)")
|
||||
expect(text).to eq("[#l](#{AppConfig.url_to(tag_path('l'))}) [#lol](#{AppConfig.url_to(tag_path('lol'))})")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -444,7 +444,9 @@ describe Notifier, type: :mailer do
|
|||
mails = Notifier.admin("#Welcome to bureaucracy!", [bob])
|
||||
expect(mails.length).to eq(1)
|
||||
mail = mails.first
|
||||
expect(mail.body.encoded).to match "<p><a href=\"http://localhost:9887/tags/welcome\">#Welcome</a> to bureaucracy!</p>"
|
||||
expect(mail.body.encoded).to match(
|
||||
"<p><a href=\"#{AppConfig.url_to(tag_path('welcome'))}\">#Welcome</a> to bureaucracy!</p>"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue