Skip to content

Commit 3241a9e

Browse files
author
George Zhukov
committed
added subdomain non-case-sensitive fix
1 parent 56a1c38 commit 3241a9e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/detectify/query_builder/base.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ class Base
44
attr_reader :domain, :subdomain
55

66
def initialize(domain, subdomain)
7-
@domain = domain
8-
@subdomain = subdomain
7+
@domain = domain.downcase if domain.is_a?(String)
8+
@subdomain = subdomain.downcase if subdomain.is_a?(String)
99
end
1010

1111
def build
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'spec_helper'
2+
3+
RSpec.describe Detectify::QueryBuilder::Base do
4+
let(:domain) { 'DOMAIN' }
5+
let(:subdomain) { 'SUBDOMAIN' }
6+
subject { Detectify::QueryBuilder::Base.new(domain, subdomain) }
7+
8+
describe '#initialize' do
9+
it 'sets domain in downcase' do
10+
expect(subject.domain).to eq(domain.downcase)
11+
end
12+
13+
it 'sets subdomain in downcase' do
14+
expect(subject.subdomain).to eq(subdomain.downcase)
15+
end
16+
end
17+
end

0 commit comments

Comments
 (0)