about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-01-10 19:12:10 +0100
committerThibaut Girka <thib@sitedethib.com>2019-01-10 21:00:30 +0100
commita2a64ecd3e3551707412c47f0d16e484dea25632 (patch)
treebc4e0b8e0ca2a2735f527bff8bd73421c0ff72dd /spec/controllers
parentfb0c906c717f2b21bb63610742a357850142b522 (diff)
parent70801b850c78d7879182eeba4eae509af42fafeb (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- .eslintrc.yml
  Removed, as upstream removed it.
- app/controllers/admin/statuses_controller.rb
  Minor code cleanup when porting one of our features.
- app/models/account.rb
  Note length validation has changed upstream.
  We now use upstream's validation (dropped legacy glitch-soc
  account metadata stuff) but with configurable limit.
- app/services/post_status_service.rb
  Upstream has added support for scheduled toots, refactoring
  the code a bit. Adapted our changes to this refactoring.
- app/views/stream_entries/_detailed_status.html.haml
  Not a real conflict, changes too close.
- app/views/stream_entries/_simple_status.html.haml
  Not a real conflict, changes too close.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin/domain_blocks_controller_spec.rb24
-rw-r--r--spec/controllers/api/v1/conversations_controller_spec.rb2
-rw-r--r--spec/controllers/api/v1/media_controller_spec.rb12
-rw-r--r--spec/controllers/api/v1/notifications_controller_spec.rb4
-rw-r--r--spec/controllers/api/v1/timelines/home_controller_spec.rb2
-rw-r--r--spec/controllers/api/v1/timelines/list_controller_spec.rb2
-rw-r--r--spec/controllers/api/v1/timelines/public_controller_spec.rb4
-rw-r--r--spec/controllers/api/v1/timelines/tag_controller_spec.rb2
8 files changed, 15 insertions, 37 deletions
diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb
index 79e7fea42..129bf8883 100644
--- a/spec/controllers/admin/domain_blocks_controller_spec.rb
+++ b/spec/controllers/admin/domain_blocks_controller_spec.rb
@@ -7,26 +7,6 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
     sign_in Fabricate(:user, admin: true), scope: :user
   end
 
-  describe 'GET #index' do
-    around do |example|
-      default_per_page = DomainBlock.default_per_page
-      DomainBlock.paginates_per 1
-      example.run
-      DomainBlock.paginates_per default_per_page
-    end
-
-    it 'renders domain blocks' do
-      2.times { Fabricate(:domain_block) }
-
-      get :index, params: { page: 2 }
-
-      assigned = assigns(:domain_blocks)
-      expect(assigned.count).to eq 1
-      expect(assigned.klass).to be DomainBlock
-      expect(response).to have_http_status(200)
-    end
-  end
-
   describe 'GET #new' do
     it 'assigns a new domain block' do
       get :new
@@ -53,7 +33,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
 
       expect(DomainBlockWorker).to have_received(:perform_async)
       expect(flash[:notice]).to eq I18n.t('admin.domain_blocks.created_msg')
-      expect(response).to redirect_to(admin_domain_blocks_path)
+      expect(response).to redirect_to(admin_instances_path(limited: '1'))
     end
 
     it 'renders new when failed to save' do
@@ -76,7 +56,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
 
       expect(service).to have_received(:call).with(domain_block, true)
       expect(flash[:notice]).to eq I18n.t('admin.domain_blocks.destroyed_msg')
-      expect(response).to redirect_to(admin_domain_blocks_path)
+      expect(response).to redirect_to(admin_instances_path(limited: '1'))
     end
   end
 end
diff --git a/spec/controllers/api/v1/conversations_controller_spec.rb b/spec/controllers/api/v1/conversations_controller_spec.rb
index 2e9525855..070f65061 100644
--- a/spec/controllers/api/v1/conversations_controller_spec.rb
+++ b/spec/controllers/api/v1/conversations_controller_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe Api::V1::ConversationsController, type: :controller do
     let(:scopes) { 'read:statuses' }
 
     before do
-      PostStatusService.new.call(other.account, 'Hey @alice', nil, visibility: 'direct')
+      PostStatusService.new.call(other.account, text: 'Hey @alice', visibility: 'direct')
     end
 
     it 'returns http success' do
diff --git a/spec/controllers/api/v1/media_controller_spec.rb b/spec/controllers/api/v1/media_controller_spec.rb
index f01fcd942..4e3037208 100644
--- a/spec/controllers/api/v1/media_controller_spec.rb
+++ b/spec/controllers/api/v1/media_controller_spec.rb
@@ -84,19 +84,17 @@ RSpec.describe Api::V1::MediaController, type: :controller do
         post :create, params: { file: fixture_file_upload('files/attachment.webm', 'video/webm') }
       end
 
-      xit 'returns http success' do
+      it do
+        # returns http success
         expect(response).to have_http_status(200)
-      end
 
-      xit 'creates a media attachment' do
+        # creates a media attachment
         expect(MediaAttachment.first).to_not be_nil
-      end
 
-      xit 'uploads a file' do
+        # uploads a file
         expect(MediaAttachment.first).to have_attached_file(:file)
-      end
 
-      xit 'returns media ID in JSON' do
+        # returns media ID in JSON
         expect(body_as_json[:id]).to eq MediaAttachment.first.id.to_s
       end
     end
diff --git a/spec/controllers/api/v1/notifications_controller_spec.rb b/spec/controllers/api/v1/notifications_controller_spec.rb
index 9f679cb8a..d0f82e79f 100644
--- a/spec/controllers/api/v1/notifications_controller_spec.rb
+++ b/spec/controllers/api/v1/notifications_controller_spec.rb
@@ -50,9 +50,9 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
     let(:scopes) { 'read:notifications' }
 
     before do
-      first_status = PostStatusService.new.call(user.account, 'Test')
+      first_status = PostStatusService.new.call(user.account, text: 'Test')
       @reblog_of_first_status = ReblogService.new.call(other.account, first_status)
-      mentioning_status = PostStatusService.new.call(other.account, 'Hello @alice')
+      mentioning_status = PostStatusService.new.call(other.account, text: 'Hello @alice')
       @mention_from_status = mentioning_status.mentions.first
       @favourite = FavouriteService.new.call(other.account, first_status)
       @follow = FollowService.new.call(other.account, 'alice')
diff --git a/spec/controllers/api/v1/timelines/home_controller_spec.rb b/spec/controllers/api/v1/timelines/home_controller_spec.rb
index 63d624c35..e953e4649 100644
--- a/spec/controllers/api/v1/timelines/home_controller_spec.rb
+++ b/spec/controllers/api/v1/timelines/home_controller_spec.rb
@@ -17,7 +17,7 @@ describe Api::V1::Timelines::HomeController do
     describe 'GET #show' do
       before do
         follow = Fabricate(:follow, account: user.account)
-        PostStatusService.new.call(follow.target_account, 'New status for user home timeline.')
+        PostStatusService.new.call(follow.target_account, text: 'New status for user home timeline.')
       end
 
       it 'returns http success' do
diff --git a/spec/controllers/api/v1/timelines/list_controller_spec.rb b/spec/controllers/api/v1/timelines/list_controller_spec.rb
index 93a2be6e6..45e4bf34c 100644
--- a/spec/controllers/api/v1/timelines/list_controller_spec.rb
+++ b/spec/controllers/api/v1/timelines/list_controller_spec.rb
@@ -19,7 +19,7 @@ describe Api::V1::Timelines::ListController do
       before do
         follow = Fabricate(:follow, account: user.account)
         list.accounts << follow.target_account
-        PostStatusService.new.call(follow.target_account, 'New status for user home timeline.')
+        PostStatusService.new.call(follow.target_account, text: 'New status for user home timeline.')
       end
 
       it 'returns http success' do
diff --git a/spec/controllers/api/v1/timelines/public_controller_spec.rb b/spec/controllers/api/v1/timelines/public_controller_spec.rb
index a0f778cdc..737aedba6 100644
--- a/spec/controllers/api/v1/timelines/public_controller_spec.rb
+++ b/spec/controllers/api/v1/timelines/public_controller_spec.rb
@@ -16,7 +16,7 @@ describe Api::V1::Timelines::PublicController do
 
     describe 'GET #show' do
       before do
-        PostStatusService.new.call(user.account, 'New status from user for federated public timeline.')
+        PostStatusService.new.call(user.account, text: 'New status from user for federated public timeline.')
       end
 
       it 'returns http success' do
@@ -29,7 +29,7 @@ describe Api::V1::Timelines::PublicController do
 
     describe 'GET #show with local only' do
       before do
-        PostStatusService.new.call(user.account, 'New status from user for local public timeline.')
+        PostStatusService.new.call(user.account, text: 'New status from user for local public timeline.')
       end
 
       it 'returns http success' do
diff --git a/spec/controllers/api/v1/timelines/tag_controller_spec.rb b/spec/controllers/api/v1/timelines/tag_controller_spec.rb
index 472779f54..f71ca2a39 100644
--- a/spec/controllers/api/v1/timelines/tag_controller_spec.rb
+++ b/spec/controllers/api/v1/timelines/tag_controller_spec.rb
@@ -16,7 +16,7 @@ describe Api::V1::Timelines::TagController do
 
     describe 'GET #show' do
       before do
-        PostStatusService.new.call(user.account, 'It is a #test')
+        PostStatusService.new.call(user.account, text: 'It is a #test')
       end
 
       it 'returns http success' do