Skip to content

Commit

Permalink
added subdomain non-case-sensitive fix
Browse files Browse the repository at this point in the history
  • Loading branch information
George Zhukov committed Sep 8, 2016
1 parent 56a1c38 commit 3241a9e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/detectify/query_builder/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class Base
attr_reader :domain, :subdomain

def initialize(domain, subdomain)
@domain = domain
@subdomain = subdomain
@domain = domain.downcase if domain.is_a?(String)
@subdomain = subdomain.downcase if subdomain.is_a?(String)
end

def build
Expand Down
17 changes: 17 additions & 0 deletions spec/detectify/query_builder/base_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

RSpec.describe Detectify::QueryBuilder::Base do
let(:domain) { 'DOMAIN' }
let(:subdomain) { 'SUBDOMAIN' }
subject { Detectify::QueryBuilder::Base.new(domain, subdomain) }

describe '#initialize' do
it 'sets domain in downcase' do
expect(subject.domain).to eq(domain.downcase)
end

it 'sets subdomain in downcase' do
expect(subject.subdomain).to eq(subdomain.downcase)
end
end
end

0 comments on commit 3241a9e

Please sign in to comment.