about summary refs log tree commit diff
path: root/spec/controllers/settings/exports
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-03-05 20:43:48 +0100
committerClaire <claire.github-309c@sitedethib.com>2023-03-05 20:46:56 +0100
commit7623e181247b4d2227b7774143514f6e1ca9253b (patch)
treeb9a82790b7cb1f075769e7e5ca757b2ede322620 /spec/controllers/settings/exports
parentbb4e211c86270de6de8a78da96295208ee77dce1 (diff)
parentdfa9843ac85d04e1facb2f757fd9288d8bb9fb2c (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `README.md`:
  Upstream README has been changed, but we have a completely different one.
  Kept our `README.md`.
- `lib/sanitize_ext/sanitize_config.rb`:
  Upstream added support for more incoming HTML tags (a large subset of what
  glitch-soc accepts).
  Change the code style to match upstream's but otherwise do not change our
  code.
- `spec/lib/sanitize_config_spec.rb`:
  Upstream added support for more incoming HTML tags (a large subset of what
  glitch-soc accepts).
  Kept our version, since the tests are mostly glitch-soc's, except for cases
  which are purposefuly different.
Diffstat (limited to 'spec/controllers/settings/exports')
-rw-r--r--spec/controllers/settings/exports/blocked_domains_controller_spec.rb20
-rw-r--r--spec/controllers/settings/exports/lists_controller_spec.rb21
2 files changed, 41 insertions, 0 deletions
diff --git a/spec/controllers/settings/exports/blocked_domains_controller_spec.rb b/spec/controllers/settings/exports/blocked_domains_controller_spec.rb
new file mode 100644
index 000000000..ac72fd9dd
--- /dev/null
+++ b/spec/controllers/settings/exports/blocked_domains_controller_spec.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Settings::Exports::BlockedDomainsController do
+  render_views
+
+  describe 'GET #index' do
+    it 'returns a csv of the domains' do
+      account = Fabricate(:account, domain: 'example.com')
+      user = Fabricate(:user, account: account)
+      Fabricate(:account_domain_block, domain: 'example.com', account: account)
+
+      sign_in user, scope: :user
+      get :index, format: :csv
+
+      expect(response.body).to eq "example.com\n"
+    end
+  end
+end
diff --git a/spec/controllers/settings/exports/lists_controller_spec.rb b/spec/controllers/settings/exports/lists_controller_spec.rb
new file mode 100644
index 000000000..29623ba49
--- /dev/null
+++ b/spec/controllers/settings/exports/lists_controller_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Settings::Exports::ListsController do
+  render_views
+
+  describe 'GET #index' do
+    it 'returns a csv of the domains' do
+      account = Fabricate(:account)
+      user = Fabricate(:user, account: account)
+      list = Fabricate(:list, account: account, title: 'The List')
+      Fabricate(:list_account, list: list, account: account)
+
+      sign_in user, scope: :user
+      get :index, format: :csv
+
+      expect(response.body).to match 'The List'
+    end
+  end
+end