diff options
author | David Yip <yipdw@member.fsf.org> | 2017-11-16 22:52:37 -0600 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-11-16 22:52:37 -0600 |
commit | b28b405b9763a0bb3df653b51e6d084b42e9a54d (patch) | |
tree | c69f1ccb99440fea8cc94014e77687238e205160 /spec | |
parent | ee560abdbe7a2caf0f7ac6137faf248bbaff9a93 (diff) | |
parent | dc6e031364d1f47a49ea47f20070a4e9986a4c68 (diff) |
Merge remote-tracking branch 'origin/master' into gs-master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/settings/applications_controller_spec.rb | 10 | ||||
-rw-r--r-- | spec/fixtures/requests/attachment1.txt | bin | 192053 -> 192052 bytes | |||
-rw-r--r-- | spec/fixtures/requests/attachment2.txt | bin | 109078 -> 109077 bytes | |||
-rw-r--r-- | spec/fixtures/requests/avatar.txt | bin | 109962 -> 109961 bytes | |||
-rw-r--r-- | spec/fixtures/requests/idn.txt | 14 | ||||
-rw-r--r-- | spec/helpers/stream_entries_helper_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/user_settings_decorator_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/remote_follow_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/status_spec.rb | 23 | ||||
-rw-r--r-- | spec/services/activitypub/fetch_remote_status_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/matchers/model/model_have_error_on_field.rb | 2 |
11 files changed, 39 insertions, 20 deletions
diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb index ca66f8d23..90e6a63d5 100644 --- a/spec/controllers/settings/applications_controller_spec.rb +++ b/spec/controllers/settings/applications_controller_spec.rb @@ -2,10 +2,10 @@ require 'rails_helper' describe Settings::ApplicationsController do render_views - + let!(:user) { Fabricate(:user) } let!(:app) { Fabricate(:application, owner: user) } - + before do sign_in user, scope: :user end @@ -21,7 +21,7 @@ describe Settings::ApplicationsController do end end - + describe 'GET #show' do it 'returns http success' do get :show, params: { id: app.id } @@ -110,7 +110,7 @@ describe Settings::ApplicationsController do end end end - + describe 'PATCH #update' do context 'success' do let(:opts) { @@ -131,7 +131,7 @@ describe Settings::ApplicationsController do call_update expect(app.reload.website).to eql(opts[:website]) end - + it 'redirects back to applications page' do expect(call_update).to redirect_to(settings_applications_path) end diff --git a/spec/fixtures/requests/attachment1.txt b/spec/fixtures/requests/attachment1.txt index 77fd9c836..30bd456be 100644 --- a/spec/fixtures/requests/attachment1.txt +++ b/spec/fixtures/requests/attachment1.txt Binary files differdiff --git a/spec/fixtures/requests/attachment2.txt b/spec/fixtures/requests/attachment2.txt index 917a1d398..2a252d2de 100644 --- a/spec/fixtures/requests/attachment2.txt +++ b/spec/fixtures/requests/attachment2.txt Binary files differdiff --git a/spec/fixtures/requests/avatar.txt b/spec/fixtures/requests/avatar.txt index d57b0984f..d771f5dda 100644 --- a/spec/fixtures/requests/avatar.txt +++ b/spec/fixtures/requests/avatar.txt Binary files differdiff --git a/spec/fixtures/requests/idn.txt b/spec/fixtures/requests/idn.txt index 3c76c59c0..5d07f2b79 100644 --- a/spec/fixtures/requests/idn.txt +++ b/spec/fixtures/requests/idn.txt @@ -6,7 +6,7 @@ Content-Length: 38111 Last-Modified: Wed, 20 Jul 2016 02:50:52 GMT Connection: keep-alive Accept-Ranges: bytes - + <!DOCTYPE html> <html> <head> @@ -21,16 +21,16 @@ Accept-Ranges: bytes var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); - + </script> - - + + <link rel="stylesheet" type="text/css" href="css/common.css"/> <script src="js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/common.js" type="text/javascript" charset="utf-8"></script> <script src="js/carousel.js" type="text/javascript" charset="utf-8"></script> <title>中国域名网站</title> - + </head> <body> <div class="head-tips" id="headTip"> @@ -453,7 +453,7 @@ Accept-Ranges: bytes <li><a href="http://新疆农业大学.中国" target="_blank">新疆农业大学.中国</a></li> <li><a href="http://浙江万里学院.中国" target="_blank">浙江万里学院.中国</a></li> <li><a href="http://重庆大学.中国" target="_blank">重庆大学.中国</a></li> - + </ul> </div> </div> @@ -472,7 +472,7 @@ Accept-Ranges: bytes <script> $("#headTip").hide() var hostname = window.location.hostname || ""; - + var tips = "您所访问的域名 <font size='' color='#ff0000'>" + hostname +"</font> 无法到达,您可以尝试重新访问,或使用搜索相关信息" if (hostname != "导航.中国") { $("#headTip").html(tips); diff --git a/spec/helpers/stream_entries_helper_spec.rb b/spec/helpers/stream_entries_helper_spec.rb index 2c0d7b239..1de6691ba 100644 --- a/spec/helpers/stream_entries_helper_spec.rb +++ b/spec/helpers/stream_entries_helper_spec.rb @@ -77,7 +77,7 @@ RSpec.describe StreamEntriesHelper, type: :helper do params[:controller] = StreamEntriesHelper::EMBEDDED_CONTROLLER params[:action] = StreamEntriesHelper::EMBEDDED_ACTION end - + describe '#style_classes' do it do status = double(reblog?: false) @@ -202,7 +202,7 @@ RSpec.describe StreamEntriesHelper, type: :helper do expect(css_class).to eq 'h-cite' end end - + describe '#rtl?' do it 'is false if text is empty' do expect(helper).not_to be_rtl '' diff --git a/spec/lib/user_settings_decorator_spec.rb b/spec/lib/user_settings_decorator_spec.rb index 6fbf6536b..fee875373 100644 --- a/spec/lib/user_settings_decorator_spec.rb +++ b/spec/lib/user_settings_decorator_spec.rb @@ -62,7 +62,7 @@ describe UserSettingsDecorator do settings.update(values) expect(user.settings['auto_play_gif']).to eq false end - + it 'updates the user settings value for system font in UI' do values = { 'setting_system_font_ui' => '0' } diff --git a/spec/models/remote_follow_spec.rb b/spec/models/remote_follow_spec.rb index 7a4597ee7..72c580f9f 100644 --- a/spec/models/remote_follow_spec.rb +++ b/spec/models/remote_follow_spec.rb @@ -35,7 +35,7 @@ RSpec.describe RemoteFollow do context 'attrs with acct' do let(:attrs) { { acct: 'gargron@quitter.no' }} - + it do is_expected.to be true end diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index 91fd13c94..89ad3adcf 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -47,8 +47,27 @@ RSpec.describe Status, type: :model do end describe '#verb' do - it 'is always post' do - expect(subject.verb).to be :post + context 'if destroyed?' do + it 'returns :delete' do + subject.destroy! + expect(subject.verb).to be :delete + end + end + + context 'unless destroyed?' do + context 'if reblog?' do + it 'returns :share' do + subject.reblog = other + expect(subject.verb).to be :share + end + end + + context 'unless reblog?' do + it 'returns :post' do + subject.reblog = nil + expect(subject.verb).to be :post + end + end end end diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb index ebf422392..51f3fe3a1 100644 --- a/spec/services/activitypub/fetch_remote_status_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb @@ -27,7 +27,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService do it 'creates status' do status = sender.statuses.first - + expect(status).to_not be_nil expect(status.text).to eq 'Lorem ipsum' end diff --git a/spec/support/matchers/model/model_have_error_on_field.rb b/spec/support/matchers/model/model_have_error_on_field.rb index 5d5fe1c7b..a5dfbf457 100644 --- a/spec/support/matchers/model/model_have_error_on_field.rb +++ b/spec/support/matchers/model/model_have_error_on_field.rb @@ -9,7 +9,7 @@ RSpec::Matchers.define :model_have_error_on_field do |expected| failure_message do |record| keys = record.errors.keys - + "expect record.errors(#{keys}) to include #{expected}" end end |