Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Feb 22, 2024
1 parent 793bca2 commit 3fbf420
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/admin/ng_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def detect_keyword?(text, arr)

class << self
def string_to_array(text)
text.split("\n")
text.delete("\r").split("\n")
end

def detect_keyword(text, arr)
Expand Down
8 changes: 8 additions & 0 deletions spec/models/admin/ng_rule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@
it_behaves_like 'matches rule', 'account'
end

context 'with display name rule' do
let(:uri) { '' }
let(:account) { Fabricate(:account, display_name: '') }
let(:ng_rule) { Fabricate(:ng_rule, account_display_name: "?^$\r\n?[a-z0-9]{10}", account_include_local: true) }

it_behaves_like 'matches rule', 'account'
end

context 'with field name rule' do
let(:account) { Fabricate(:account, fields_attributes: { '0' => { name: 'Name', value: 'Value' } }, domain: 'example.com', uri: uri) }
let(:ng_rule) { Fabricate(:ng_rule, account_field_name: 'Name') }
Expand Down

0 comments on commit 3fbf420

Please sign in to comment.