VRFS-3036 description testing
This commit is contained in:
parent
965ee2e0bc
commit
0691e079af
|
|
@ -100,7 +100,7 @@ module JamRuby
|
|||
KEY_BAND_STATUS => BAND_STATUS_VALS[0],
|
||||
KEY_PERF_SAMPLES => self::PERF_SAMPLES_VALS[0],
|
||||
KEY_HIRE_MAX_COST => 0,
|
||||
KEY_HIRE_FREE => 1,
|
||||
KEY_HIRE_FREE => 0,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
@ -387,12 +387,12 @@ module JamRuby
|
|||
str += "; Maximum gig cost = $#{val}"
|
||||
end if filter.has_key?(KEY_HIRE_MAX_COST)
|
||||
|
||||
if filter[KEY_HIRE_FREE]
|
||||
if 0 < filter[KEY_HIRE_FREE]
|
||||
str += "; Bands playing free gigs"
|
||||
end if filter.has_key?(KEY_HIRE_FREE)
|
||||
|
||||
if (val = filter[KEY_GIGS].to_i) != GIG_COUNTS[0]
|
||||
str += "; Concert Gigs = #{GIG_LABELS[val]}"
|
||||
str += "; Concert gigs = #{GIG_LABELS[val]}"
|
||||
end if filter.has_key?(KEY_GIGS)
|
||||
|
||||
if 0 < (val = filter[KEY_GENRES]).length
|
||||
|
|
|
|||
|
|
@ -62,12 +62,11 @@ describe 'Band Search Model' do
|
|||
end
|
||||
|
||||
describe "generates description" do
|
||||
let!(:filter) { to_join }
|
||||
|
||||
def check_description(_filter, subtype, key, value, lookup, label)
|
||||
_filter[key] = value
|
||||
search.search_results_page(subtype, _filter)
|
||||
expect(search.description).to match(/Current Search: Sort = .*; #{label} = #{lookup[value]}$/)
|
||||
expect(search.description(subtype)).to match(/Current Search: Sort = .*; #{label} = #{lookup[value]}$/)
|
||||
end
|
||||
|
||||
it "renders no description for blank" do
|
||||
|
|
@ -76,69 +75,120 @@ describe 'Band Search Model' do
|
|||
end
|
||||
|
||||
it "renders description for sort order" do
|
||||
filter[BandSearch::KEY_TOUR_OPTION] = BandSearch::VAL_YES
|
||||
search.search_results_page(BandSearch::TO_JOIN, filter)
|
||||
to_join[BandSearch::KEY_TOUR_OPTION] = BandSearch::VAL_YES
|
||||
search.search_results_page(BandSearch::TO_JOIN, to_join)
|
||||
search.search_results_page
|
||||
expect(search.description).to match(/Sort =/)
|
||||
end
|
||||
|
||||
it "renders description for band type" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_BAND_TYPE,
|
||||
BandSearch::BAND_TYPE_VAL_STRS[1],
|
||||
BandSearch::BAND_TYPES,
|
||||
'Band type')
|
||||
context "to_join" do
|
||||
|
||||
it "renders description for band type" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_BAND_TYPE,
|
||||
BandSearch::BAND_TYPE_VAL_STRS[1],
|
||||
BandSearch::BAND_TYPES,
|
||||
'Band type')
|
||||
end
|
||||
|
||||
it "renders description for band status" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_BAND_STATUS,
|
||||
BandSearch::SKILL_VALS[1],
|
||||
BandSearch::BAND_STATUS,
|
||||
'Band status')
|
||||
end
|
||||
|
||||
it "renders description for concert gigs" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_GIGS,
|
||||
BandSearch::GIG_COUNTS[1],
|
||||
BandSearch::GIG_LABELS,
|
||||
'Concert gigs')
|
||||
end
|
||||
|
||||
it "renders description for play commitment" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_PLAY_COMMIT,
|
||||
BandSearch::PLAY_COMMIT_VALS[1],
|
||||
BandSearch::PLAY_COMMITS,
|
||||
'Play commitment')
|
||||
end
|
||||
|
||||
it "renders description for tour option" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_TOUR_OPTION,
|
||||
BandSearch::VAL_YES,
|
||||
BandSearch::TOUR_OPTIONS,
|
||||
'Touring options')
|
||||
end
|
||||
|
||||
it "renders description for genres" do
|
||||
to_join[BandSearch::KEY_GENRES] = [Genre.first.id]
|
||||
search.search_results_page(BandSearch::TO_JOIN, to_join)
|
||||
expect(search.description).to match(/Current Search: Sort = .*; Genres = #{Genre.first.description}$/)
|
||||
end
|
||||
|
||||
it "renders description for instruments" do
|
||||
to_join[BandSearch::KEY_INSTRUMENTS] = [{ 'instrument_id' => Instrument.first.id, 'proficiency_level' => 1 }]
|
||||
search.search_results_page(BandSearch::TO_JOIN, to_join)
|
||||
expect(search.description).to match(/Current Search: Sort = .*; Instruments = #{Instrument.first.description} \(#{BandSearch::INSTRUMENT_PROFICIENCY[1]}\)$/)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "renders description for band status" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_BAND_STATUS,
|
||||
BandSearch::SKILL_VALS[1],
|
||||
BandSearch::BAND_STATUS,
|
||||
'Band status')
|
||||
end
|
||||
context "to_hire" do
|
||||
it "renders description for genres" do
|
||||
to_hire[BandSearch::KEY_GENRES] = [Genre.first.id]
|
||||
search.search_results_page(BandSearch::TO_HIRE, to_hire)
|
||||
expect(search.description(BandSearch::TO_HIRE)).to match(/Current Search: Sort = .*; Genres = #{Genre.first.description}$/)
|
||||
end
|
||||
|
||||
it "renders description for play commitment" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_PLAY_COMMIT,
|
||||
BandSearch::PLAY_COMMIT_VALS[1],
|
||||
BandSearch::PLAY_COMMITS,
|
||||
'Play commitment')
|
||||
end
|
||||
it "renders description for band status" do
|
||||
check_description(to_hire,
|
||||
BandSearch::TO_HIRE,
|
||||
BandSearch::KEY_BAND_STATUS,
|
||||
BandSearch::BAND_STATUS_VALS[1],
|
||||
BandSearch::BAND_STATUS,
|
||||
'Band status')
|
||||
end
|
||||
|
||||
it "renders description for tour option" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_TOUR_OPTION,
|
||||
BandSearch::VAL_YES,
|
||||
BandSearch::TOUR_OPTIONS,
|
||||
'Touring options')
|
||||
end
|
||||
it "renders description for concert gigs" do
|
||||
check_description(to_hire,
|
||||
BandSearch::TO_HIRE,
|
||||
BandSearch::KEY_GIGS,
|
||||
BandSearch::GIG_COUNTS[1],
|
||||
BandSearch::GIG_LABELS,
|
||||
'Concert gigs')
|
||||
end
|
||||
|
||||
it "renders description for performance samples" do
|
||||
check_description(to_join,
|
||||
BandSearch::TO_JOIN,
|
||||
BandSearch::KEY_PERF_SAMPLES,
|
||||
BandSearch::PERF_SAMPLES_VALS[1],
|
||||
BandSearch::PERF_SAMPLES,
|
||||
'Performance samples')
|
||||
end
|
||||
it "renders description for performance samples" do
|
||||
check_description(to_hire,
|
||||
BandSearch::TO_HIRE,
|
||||
BandSearch::KEY_PERF_SAMPLES,
|
||||
BandSearch::PERF_SAMPLES_VALS[1],
|
||||
BandSearch::PERF_SAMPLES,
|
||||
'Performance samples')
|
||||
end
|
||||
|
||||
it "renders description for genres" do
|
||||
to_join[BandSearch::KEY_GENRES] = [Genre.first.id]
|
||||
search.search_results_page(BandSearch::TO_JOIN, to_join)
|
||||
expect(search.description).to match(/Current Search: Sort = .*; Genres = #{Genre.first.description}$/)
|
||||
end
|
||||
it "renders description max cost" do
|
||||
to_hire[BandSearch::KEY_HIRE_MAX_COST] = 100
|
||||
search.search_results_page(BandSearch::TO_HIRE, to_hire)
|
||||
expect(search.description(BandSearch::TO_HIRE)).to match(/Current Search: Sort = .*; Maximum gig cost = \$100$/)
|
||||
end
|
||||
|
||||
it "renders description for instruments" do
|
||||
to_join[BandSearch::KEY_INSTRUMENTS] = [{ 'instrument_id' => Instrument.first.id, 'proficiency_level' => 1 }]
|
||||
search.search_results_page(BandSearch::TO_JOIN, to_join)
|
||||
expect(search.description).to match(/Current Search: Sort = .*; Instruments = #{Instrument.first.description} \(#{BandSearch::INSTRUMENT_PROFICIENCY[1]}\)$/)
|
||||
end
|
||||
it "renders description free gigs" do
|
||||
to_hire[BandSearch::KEY_HIRE_FREE] = 1
|
||||
search.search_results_page(BandSearch::TO_HIRE, to_hire)
|
||||
expect(search.description(BandSearch::TO_HIRE)).to match(/Current Search: Sort = .*; Bands playing free gigs$/)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue