Skip to content

Commit

Permalink
skip only with adapter is sqlite3 not mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
stefannibrasil committed Aug 25, 2018
1 parent 02d5a66 commit 6324de0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions test/functional/api/search_api_full_text_test.rb
Expand Up @@ -9,7 +9,7 @@ def app
end

def search_profiles_by_username_and_bio_without_order_by_and_default_sort_direction
skip "full text search only works on mysql/mariadb" if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
skip "full text search only works on mysql/mariadb" if ActiveRecord::Base.connection.adapter_name == 'sqlite3'

get '/api/srch/profiles?srchString=steff'
assert last_response.ok?
Expand All @@ -35,7 +35,7 @@ def search_profiles_by_username_and_bio_without_order_by_and_default_sort_direct
end

def search_profiles_by_bio_without_order_by_and_default_sort_direction
skip "full text search only works on mysql/mariadb" if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
skip "full text search only works on mysql/mariadb" if ActiveRecord::Base.connection.adapter_name == 'sqlite3'
get '/api/srch/profiles?srchString=ruby'
assert last_response.ok?

Expand Down
21 changes: 20 additions & 1 deletion test/unit/api/search_service_full_text_search_test.rb
Expand Up @@ -13,7 +13,7 @@ def create_profiles_doc_list(list)
end

def running_profiles_by_username_and_bio
skip "full text search only works on mysql/mariadb" if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
skip "full text search only works on mysql/mariadb" if ActiveRecord::Base.connection.adapter_name == 'sqlite3'

users = [users(:data), users(:steff3), users(:steff2), users(:steff1)]
sresult = create_profiles_doc_list(users)
Expand All @@ -29,4 +29,23 @@ def running_profiles_by_username_and_bio
assert_equal result.getDocs.to_json, sresult.getDocs.to_json
assert_equal result.getDocs.to_json.length, result.getDocs.uniq.to_json.length
end

test 'running profiles by username and bio' do
# User.search() only works for mysql/mariadb
if ActiveRecord::Base.connection.adapter_name == 'sqlite3'
users = [users(:data), users(:steff3), users(:steff2), users(:steff1)]
sresult = create_profiles_doc_list(users)

params = { srchString: 'steff' }
search_criteria = SearchCriteria.new(params)

result = SearchService.new.profiles(search_criteria)

assert_not_nil result
assert_equal result.getDocs.size, 4

assert_equal result.getDocs.to_json, sresult.getDocs.to_json
assert_equal result.getDocs.to_json.length, result.getDocs.uniq.to_json.length
end
end
end
19 changes: 0 additions & 19 deletions test/unit/api/search_service_test.rb
Expand Up @@ -82,25 +82,6 @@ def create_questions_doc_list(notes)
assert_equal result.getDocs.to_json.length, result.getDocs.uniq.to_json.length
end

test 'running profiles by username and bio' do
# User.search() only works for mysql/mariadb
if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
users = [users(:data), users(:steff3), users(:steff2), users(:steff1)]
sresult = create_profiles_doc_list(users)

params = { srchString: 'steff' }
search_criteria = SearchCriteria.new(params)

result = SearchService.new.profiles(search_criteria)

assert_not_nil result
assert_equal result.getDocs.size, 4

assert_equal result.getDocs.to_json, sresult.getDocs.to_json
assert_equal result.getDocs.to_json.length, result.getDocs.uniq.to_json.length
end
end

test 'running people locations' do
users = [users(:bob)]
sresult = create_people_location_doc_list(users)
Expand Down

0 comments on commit 6324de0

Please sign in to comment.