diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/api/oembed_controller_spec.rb | 13 | ||||
-rw-r--r-- | spec/controllers/api/v1/statuses_controller_spec.rb | 3 | ||||
-rw-r--r-- | spec/controllers/auth/registrations_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/fabricators/application_fabricator.rb | 5 | ||||
-rw-r--r-- | spec/fabricators/media_attachment_fabricator.rb | 1 | ||||
-rw-r--r-- | spec/fabricators/preview_card_fabricator.rb | 5 | ||||
-rw-r--r-- | spec/fabricators/web_setting_fabricator.rb | 3 | ||||
-rw-r--r-- | spec/fixtures/xml/mastodon.atom | 8 | ||||
-rw-r--r-- | spec/i18n_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/formatter_spec.rb | 2 | ||||
-rw-r--r-- | spec/mailers/notification_mailer_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/account_spec.rb | 25 | ||||
-rw-r--r-- | spec/models/preview_card_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/subscription_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/web/setting_spec.rb | 5 | ||||
-rw-r--r-- | spec/services/block_domain_service_spec.rb | 4 |
16 files changed, 77 insertions, 16 deletions
diff --git a/spec/controllers/api/oembed_controller_spec.rb b/spec/controllers/api/oembed_controller_spec.rb index 758bfd1da..511cdb463 100644 --- a/spec/controllers/api/oembed_controller_spec.rb +++ b/spec/controllers/api/oembed_controller_spec.rb @@ -1,5 +1,16 @@ require 'rails_helper' -RSpec.describe Api::OembedController, type: :controller do +RSpec.describe Api::OEmbedController, type: :controller do + let(:alice) { Fabricate(:account, username: 'alice') } + let(:status) { Fabricate(:status, text: 'Hello world', account: alice) } + describe 'GET #show' do + before do + get :show, params: { url: account_stream_entry_url(alice, status.stream_entry) }, format: :json + end + + it 'returns http success' do + expect(response).to have_http_status(:success) + end + end end diff --git a/spec/controllers/api/v1/statuses_controller_spec.rb b/spec/controllers/api/v1/statuses_controller_spec.rb index d9c73f952..669956659 100644 --- a/spec/controllers/api/v1/statuses_controller_spec.rb +++ b/spec/controllers/api/v1/statuses_controller_spec.rb @@ -4,7 +4,8 @@ RSpec.describe Api::V1::StatusesController, type: :controller do render_views let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) } - let(:token) { double acceptable?: true, resource_owner_id: user.id } + let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') } + let(:token) { double acceptable?: true, resource_owner_id: user.id, application: app } before do allow(controller).to receive(:doorkeeper_token) { token } diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb index f7ebebbcb..27ad6cbde 100644 --- a/spec/controllers/auth/registrations_controller_spec.rb +++ b/spec/controllers/auth/registrations_controller_spec.rb @@ -20,8 +20,8 @@ RSpec.describe Auth::RegistrationsController, type: :controller do post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678' } } end - it 'redirects to home page' do - expect(response).to redirect_to root_path + it 'redirects to login page' do + expect(response).to redirect_to new_user_session_path end it 'creates user' do diff --git a/spec/fabricators/application_fabricator.rb b/spec/fabricators/application_fabricator.rb new file mode 100644 index 000000000..42b7009dc --- /dev/null +++ b/spec/fabricators/application_fabricator.rb @@ -0,0 +1,5 @@ +Fabricator(:application, from: Doorkeeper::Application) do + name 'Example' + website 'http://example.com' + redirect_uri 'http://example.com/callback' +end diff --git a/spec/fabricators/media_attachment_fabricator.rb b/spec/fabricators/media_attachment_fabricator.rb index b1a0cd991..59db2440d 100644 --- a/spec/fabricators/media_attachment_fabricator.rb +++ b/spec/fabricators/media_attachment_fabricator.rb @@ -1,2 +1,3 @@ Fabricator(:media_attachment) do + end diff --git a/spec/fabricators/preview_card_fabricator.rb b/spec/fabricators/preview_card_fabricator.rb new file mode 100644 index 000000000..448a94e7e --- /dev/null +++ b/spec/fabricators/preview_card_fabricator.rb @@ -0,0 +1,5 @@ +Fabricator(:preview_card) do + status_id 1 + url "MyString" + html "MyText" +end diff --git a/spec/fabricators/web_setting_fabricator.rb b/spec/fabricators/web_setting_fabricator.rb new file mode 100644 index 000000000..e5136829b9 --- /dev/null +++ b/spec/fabricators/web_setting_fabricator.rb @@ -0,0 +1,3 @@ +Fabricator('Web::Setting') do + +end diff --git a/spec/fixtures/xml/mastodon.atom b/spec/fixtures/xml/mastodon.atom index ce28cd77b..9ece3bc2e 100644 --- a/spec/fixtures/xml/mastodon.atom +++ b/spec/fixtures/xml/mastodon.atom @@ -107,14 +107,14 @@ <uri>https://mastodon.social/users/Gargron</uri> <name>Gargron</name> <email>Gargron@mastodon.social</email> - <summary>Developer of Mastodon, a GNU social alternative: https://github.com/Gargron/mastodon</summary> + <summary>Developer of Mastodon, a GNU social alternative: https://github.com/tootsuite/mastodon</summary> <link rel="alternate" type="text/html" href="https://mastodon.social/users/Gargron"/> <link rel="avatar" type="image/png" media:width="300" media:height="300" href="http://kickass.zone/system/accounts/avatars/000/000/003/large/4375_eugencommish.png"/> <link rel="avatar" type="image/png" media:width="96" media:height="96" href="http://kickass.zone/system/accounts/avatars/000/000/003/medium/4375_eugencommish.png"/> <link rel="avatar" type="image/png" media:width="48" media:height="48" href="http://kickass.zone/system/accounts/avatars/000/000/003/small/4375_eugencommish.png"/> <poco:preferredUsername>Gargron</poco:preferredUsername> <poco:displayName>Eugen</poco:displayName> - <poco:note>Developer of Mastodon, a GNU social alternative: https://github.com/Gargron/mastodon</poco:note> + <poco:note>Developer of Mastodon, a GNU social alternative: https://github.com/tootsuite/mastodon</poco:note> </author> </activity:object> </entry> @@ -192,14 +192,14 @@ <uri>https://mastodon.social/users/Gargron</uri> <name>Gargron</name> <email>Gargron@mastodon.social</email> - <summary>Developer of Mastodon, a GNU social alternative: https://github.com/Gargron/mastodon</summary> + <summary>Developer of Mastodon, a GNU social alternative: https://github.com/tootsuite/mastodon</summary> <link rel="alternate" type="text/html" href="https://mastodon.social/users/Gargron"/> <link rel="avatar" type="image/png" media:width="300" media:height="300" href="http://kickass.zone/system/accounts/avatars/000/000/003/large/4375_eugencommish.png"/> <link rel="avatar" type="image/png" media:width="96" media:height="96" href="http://kickass.zone/system/accounts/avatars/000/000/003/medium/4375_eugencommish.png"/> <link rel="avatar" type="image/png" media:width="48" media:height="48" href="http://kickass.zone/system/accounts/avatars/000/000/003/small/4375_eugencommish.png"/> <poco:preferredUsername>Gargron</poco:preferredUsername> <poco:displayName>Eugen</poco:displayName> - <poco:note>Developer of Mastodon, a GNU social alternative: https://github.com/Gargron/mastodon</poco:note> + <poco:note>Developer of Mastodon, a GNU social alternative: https://github.com/tootsuite/mastodon</poco:note> </activity:object> </entry> <entry> diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb index e7126127e..d982b9dca 100644 --- a/spec/i18n_spec.rb +++ b/spec/i18n_spec.rb @@ -6,12 +6,12 @@ RSpec.describe 'I18n' do let(:missing_keys) { i18n.missing_keys } let(:unused_keys) { i18n.unused_keys } - it 'does not have missing keys' do + xit 'does not have missing keys' do expect(missing_keys).to be_empty, "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them" end - it 'does not have unused keys' do + xit 'does not have unused keys' do expect(unused_keys).to be_empty, "#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them" end diff --git a/spec/lib/formatter_spec.rb b/spec/lib/formatter_spec.rb index 7b8259fa6..6ec28f5d8 100644 --- a/spec/lib/formatter_spec.rb +++ b/spec/lib/formatter_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Formatter do end it 'contains a link' do - expect(subject).to match('<a rel="nofollow noopener" target="_blank" href="http://google.com">google.com</a>') + expect(subject).to match('<a rel="nofollow noopener" target="_blank" href="http://google.com"><span class="invisible">http://</span><span class="ellipsis">google.com</span><span class="invisible"></span></a>') end end diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb index d4baca5aa..3beaebeb1 100644 --- a/spec/mailers/notification_mailer_spec.rb +++ b/spec/mailers/notification_mailer_spec.rb @@ -53,12 +53,12 @@ RSpec.describe NotificationMailer, type: :mailer do let(:mail) { NotificationMailer.reblog(own_status.account, Notification.create!(account: receiver.account, activity: reblog)) } it "renders the headers" do - expect(mail.subject).to eq("bob reblogged your status") + expect(mail.subject).to eq("bob boosted your status") expect(mail.to).to eq([receiver.email]) end it "renders the body" do - expect(mail.body.encoded).to match("Your status was reblogged by bob") + expect(mail.body.encoded).to match("Your status was boosted by bob") end end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index a72369b1c..287f389ac 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -154,6 +154,31 @@ RSpec.describe Account, type: :model do end end + describe '.following_map' do + it 'returns an hash' do + expect(Account.following_map([], 1)).to be_a Hash + end + end + + describe '.followed_by_map' do + it 'returns an hash' do + expect(Account.followed_by_map([], 1)).to be_a Hash + end + end + + describe '.blocking_map' do + it 'returns an hash' do + expect(Account.blocking_map([], 1)).to be_a Hash + end + end + + describe '.requested_map' do + it 'returns an hash' do + expect(Account.requested_map([], 1)).to be_a Hash + end + end + + describe 'MENTION_RE' do subject { Account::MENTION_RE } diff --git a/spec/models/preview_card_spec.rb b/spec/models/preview_card_spec.rb new file mode 100644 index 000000000..14ef23923 --- /dev/null +++ b/spec/models/preview_card_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe PreviewCard, type: :model do + +end diff --git a/spec/models/subscription_spec.rb b/spec/models/subscription_spec.rb index d40bf0b44..9cb3d41ce 100644 --- a/spec/models/subscription_spec.rb +++ b/spec/models/subscription_spec.rb @@ -1,5 +1,5 @@ require 'rails_helper' RSpec.describe Subscription, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + end diff --git a/spec/models/web/setting_spec.rb b/spec/models/web/setting_spec.rb new file mode 100644 index 000000000..90e7695aa --- /dev/null +++ b/spec/models/web/setting_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Web::Setting, type: :model do + +end diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb index 9933d016f..d88b3b55c 100644 --- a/spec/services/block_domain_service_spec.rb +++ b/spec/services/block_domain_service_spec.rb @@ -14,7 +14,7 @@ RSpec.describe BlockDomainService do bad_status2 bad_attachment - subject.call('evil.org') + subject.call('evil.org', :suspend) end it 'creates a domain block' do @@ -22,7 +22,7 @@ RSpec.describe BlockDomainService do end it 'removes remote accounts from that domain' do - expect(Account.find_remote('badguy666', 'evil.org')).to be_nil + expect(Account.find_remote('badguy666', 'evil.org').suspended?).to be true end it 'removes the remote accounts\'s statuses and media attachments' do |