diff --git a/config/routes.rb b/config/routes.rb index 9f57813f..bb853e03 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -143,19 +143,20 @@ Rails.application.routes.draw do match '/inbox/:author', to: 'inbox#show', via: 'get' match '/user/:username(/p/:page)', to: 'user#show', via: 'get', defaults: {page: 1} - match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1} - match '/@:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer_alt - match '/@:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question_alt - match '/@:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers_alt, defaults: {page: 1} - match '/@:username/followings(/p/:page)', to: 'user#followings', via: 'get', as: :show_user_followings_alt, defaults: {page: 1} + match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1} + match '/@:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer + match '/@:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question + match '/@:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers, defaults: {page: 1} + match '/@:username/followings(/p/:page)', to: 'user#followings', via: 'get', as: :show_user_followings, defaults: {page: 1} match '/@:username/friends(/p/:page)', to: redirect('/@%{username}/followings/p/%{page}'), via: 'get', defaults: {page: 1} - match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1} - match '/:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer - match '/:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question - match '/:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers, defaults: {page: 1} - match '/:username/followings(/p/:page)', to: 'user#followings', via: 'get', as: :show_user_followings, defaults: {page: 1} + match '/@:username/questions(/p/:page)', to: 'user#questions', via: 'get', as: :show_user_questions, defaults: {page: 1} + match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1} + match '/:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer_alt + match '/:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question_alt + match '/:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers_alt, defaults: {page: 1} + match '/:username/followings(/p/:page)', to: 'user#followings', via: 'get', as: :show_user_followings_alt, defaults: {page: 1} match '/:username/friends(/p/:page)', to: redirect('/%{username}/followings/p/%{page}'), via: 'get', defaults: {page: 1} - match '/:username/questions(/p/:page)', to: 'user#questions', via: 'get', as: :show_user_questions, defaults: {page: 1} + match '/:username/questions(/p/:page)', to: 'user#questions', via: 'get', as: :show_user_questions_alt, defaults: {page: 1} match '/feedback/consent', to: 'feedback#consent', via: 'get', as: 'feedback_consent' match '/feedback/consent/update', to: 'feedback#update', via: 'post', as: 'feedback_consent_update' diff --git a/spec/helpers/application_helper/graph_methods_spec.rb b/spec/helpers/application_helper/graph_methods_spec.rb index 1be49acf..63baa848 100644 --- a/spec/helpers/application_helper/graph_methods_spec.rb +++ b/spec/helpers/application_helper/graph_methods_spec.rb @@ -18,7 +18,7 @@ describe ApplicationHelper::GraphMethods, :type => :helper do - + @@ -66,7 +66,7 @@ describe ApplicationHelper::GraphMethods, :type => :helper do - + EOS diff --git a/spec/helpers/markdown_helper_spec.rb b/spec/helpers/markdown_helper_spec.rb index 4328501e..bcfdecf1 100644 --- a/spec/helpers/markdown_helper_spec.rb +++ b/spec/helpers/markdown_helper_spec.rb @@ -20,7 +20,7 @@ describe MarkdownHelper, type: :helper do end it "should transform mentions into links" do - expect(markdown("@jake_weary")).to eq('

@jake_weary

') + expect(markdown("@jake_weary")).to eq('

@jake_weary

') end it "should escape text in links" do diff --git a/spec/helpers/social_helper/tumblr_methods_spec.rb b/spec/helpers/social_helper/tumblr_methods_spec.rb index c151a6a2..1d6ca005 100644 --- a/spec/helpers/social_helper/tumblr_methods_spec.rb +++ b/spec/helpers/social_helper/tumblr_methods_spec.rb @@ -46,7 +46,7 @@ describe SocialHelper::TumblrMethods, :type => :helper do subject { tumblr_body(answer) } it 'should return a proper body' do - expect(subject).to eq("aaaa\n\n[Smile or comment on the answer here](https://example.com/#{answer.user.screen_name}/a/#{answer.id})") + expect(subject).to eq("aaaa\n\n[Smile or comment on the answer here](https://example.com/@#{answer.user.screen_name}/a/#{answer.id})") end end @@ -54,7 +54,7 @@ describe SocialHelper::TumblrMethods, :type => :helper do subject { tumblr_share_url(answer) } it 'should return a proper share link' do - expect(subject).to eq("https://www.tumblr.com/widgets/share/tool?shareSource=legacy&posttype=text&title=#{CGI.escape(tumblr_title(answer))}&url=#{CGI.escape("https://example.com/#{answer.user.screen_name}/a/#{answer.id}")}&caption=&content=#{CGI.escape(tumblr_body(answer))}") + expect(subject).to eq("https://www.tumblr.com/widgets/share/tool?shareSource=legacy&posttype=text&title=#{CGI.escape(tumblr_title(answer))}&url=#{CGI.escape("https://example.com/@#{answer.user.screen_name}/a/#{answer.id}")}&caption=&content=#{CGI.escape(tumblr_body(answer))}") end end end diff --git a/spec/helpers/social_helper/twitter_methods_spec.rb b/spec/helpers/social_helper/twitter_methods_spec.rb index 71a5eb60..7074f6e6 100644 --- a/spec/helpers/social_helper/twitter_methods_spec.rb +++ b/spec/helpers/social_helper/twitter_methods_spec.rb @@ -23,7 +23,7 @@ describe SocialHelper::TwitterMethods, :type => :helper do subject { prepare_tweet(answer) } it 'should return a properly formatted tweet' do - expect(subject).to eq("#{'q' * 123}… — #{'a' * 124}… https://example.com/#{user.screen_name}/a/#{answer.id}") + expect(subject).to eq("#{'q' * 123}… — #{'a' * 124}… https://example.com/@#{user.screen_name}/a/#{answer.id}") end end @@ -34,7 +34,7 @@ describe SocialHelper::TwitterMethods, :type => :helper do subject { prepare_tweet(answer, '#askracc') } it 'should include the suffix after the link' do - expect(subject).to eq("question — answer #askracc https://example.com/#{user.screen_name}/a/#{answer.id}") + expect(subject).to eq("question — answer #askracc https://example.com/@#{user.screen_name}/a/#{answer.id}") end end @@ -42,7 +42,7 @@ describe SocialHelper::TwitterMethods, :type => :helper do subject { prepare_tweet(answer, '#askracc') } it 'should shorten the tweet while keeping the suffix intact' do - expect(subject).to eq("#{'q' * 120}… — #{'a' * 120}… #askracc https://example.com/#{user.screen_name}/a/#{answer.id}") + expect(subject).to eq("#{'q' * 120}… — #{'a' * 120}… #askracc https://example.com/@#{user.screen_name}/a/#{answer.id}") end end @@ -57,7 +57,7 @@ describe SocialHelper::TwitterMethods, :type => :helper do subject { prepare_tweet(answer) } it 'should return a properly formatted tweet' do - expect(subject).to eq("#{answer.question.content} — #{answer.content} https://example.com/#{user.screen_name}/a/#{answer.id}") + expect(subject).to eq("#{answer.question.content} — #{answer.content} https://example.com/@#{user.screen_name}/a/#{answer.id}") end end end diff --git a/spec/models/services/twitter_spec.rb b/spec/models/services/twitter_spec.rb index a177993d..c12870bb 100644 --- a/spec/models/services/twitter_spec.rb +++ b/spec/models/services/twitter_spec.rb @@ -29,7 +29,7 @@ describe Services::Twitter do it "posts a shortened tweet" do service.post(answer) - expect(twitter_client).to have_received(:update!).with("#{'q' * 123}… — #{'a' * 124}… https://example.com/#{user.screen_name}/a/#{answer.id}") + expect(twitter_client).to have_received(:update!).with("#{'q' * 123}… — #{'a' * 124}… https://example.com/@#{user.screen_name}/a/#{answer.id}") end it "posts an un-shortened tweet" do @@ -40,7 +40,7 @@ describe Services::Twitter do service.post(answer) - expect(twitter_client).to have_received(:update!).with("#{answer.question.content} — #{answer.content} https://example.com/#{user.screen_name}/a/#{answer.id}") + expect(twitter_client).to have_received(:update!).with("#{answer.question.content} — #{answer.content} https://example.com/@#{user.screen_name}/a/#{answer.id}") end end end \ No newline at end of file