feat: タグ補完から 0 件を除外(#109) (#245)
#109 #109 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #245
This commit was merged in pull request #245.
This commit is contained in:
@@ -4,8 +4,12 @@ require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Tags API', type: :request do
|
||||
let!(:tn) { TagName.create!(name: 'spec_tag') }
|
||||
let!(:tag) { Tag.create!(tag_name: tn, category: 'general') }
|
||||
let!(:tag) { Tag.create!(tag_name: tn, category: :general) }
|
||||
let!(:alias_tn) { TagName.create!(name: 'unko', canonical: tn) }
|
||||
let!(:post) { Post.create!(url: 'https://example.com/unkounkounko') }
|
||||
let!(:post_tag) { PostTag.create!(post:, tag:) }
|
||||
let!(:tn2) { TagName.create!(name: 'unknown') }
|
||||
let!(:tag2) { Tag.create!(tag_name: tn2, category: :general) }
|
||||
|
||||
describe 'GET /tags' do
|
||||
it 'returns tags with name' do
|
||||
@@ -71,6 +75,7 @@ RSpec.describe 'Tags API', type: :request do
|
||||
expect(json.map { |t| t['name'] }).to include('spec_tag')
|
||||
t = json.find { |t| t['name'] == 'spec_tag' }
|
||||
expect(t['matched_alias']).to eq('unko')
|
||||
expect(json.map { |t| t['name'] }).not_to include('unknown')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user