* Wip * Wip * Wip: History * Wip: テストコード作成 * Fix test * Wip * Wip * Wip * Fix test * Wip * Wip * Wip * Wip * なんとか完成、これから動作確認 * spell miss * Change ng rule timings * Fix test * Wip * Fix test * Wip * Fix form * 表示まわりの改善
This commit is contained in:
parent
0779c748a6
commit
7d96d5828e
56 changed files with 2062 additions and 42 deletions
29
spec/models/ng_rule_spec.rb
Normal file
29
spec/models/ng_rule_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe NgRule do
|
||||
describe '#copy!' do
|
||||
let(:original) { Fabricate(:ng_rule, account_domain: 'foo.bar', account_avatar_state: :needed, status_text: 'ohagi', status_mention_threshold: 5, status_allow_follower_mention: false) }
|
||||
let(:copied) { original.copy! }
|
||||
|
||||
it 'saves safely' do
|
||||
expect { copied.save! }.to_not raise_error
|
||||
expect(copied.reload.id).to_not eq original.id
|
||||
end
|
||||
|
||||
it 'saves specified rules' do
|
||||
expect(copied.account_domain).to eq 'foo.bar'
|
||||
expect(copied.account_avatar_state.to_sym).to eq :needed
|
||||
expect(copied.status_text).to eq 'ohagi'
|
||||
expect(copied.status_mention_threshold).to eq 5
|
||||
expect(copied.status_allow_follower_mention).to be false
|
||||
end
|
||||
|
||||
it 'saves default rules' do
|
||||
expect(copied.account_header_state.to_sym).to eq :optional
|
||||
expect(copied.status_spoiler_text).to eq ''
|
||||
expect(copied.status_reference_threshold).to eq(-1)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue