Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.

Commit 37e8fe2

Browse files
committed
Added EthnicityFilter
1 parent 011e6a9 commit 37e8fe2

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lib/lonely_coder/search/options/ethnicity.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def lookup(values)
77
end
88

99
class Search
10-
def add_ethnicity_option(value)
11-
# implement
10+
def add_ethnicity_option(values)
11+
@filters << EthnicityFilter.new('ethnicity', values)
1212
end
1313
end
1414
end

spec/ethnicity_filter_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
require 'spec_helper'
2+
3+
describe "EthnicityFilter" do
4+
it "adds ethnicity as an numbered filter to the query url" do
5+
@search = OKCupid::Search.new({
6+
:gentation => 'guys who like guys',
7+
:ethnicity => ['human']
8+
})
9+
@search.url.should match(/filter[\d]=9,512/)
10+
end
11+
12+
it "supports mulitple ethnicity values" do
13+
@search = OKCupid::Search.new({
14+
:gentation => 'guys who like guys',
15+
:ethnicity => ['white', 'black']
16+
})
17+
# White + Black
18+
# 256 + 8
19+
@search.url.should match(/filter[\d]=9,264/)
20+
end
21+
end

0 commit comments

Comments
 (0)