Created
July 3, 2013 11:43
-
-
Save nimdraugsael/5917241 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let(:depart_date){Date.today} | |
let(:return_date){Date.today + 5.days} | |
let(:marker){'12321'} | |
it 'should redirect to city page if file_name found' do | |
post :create, | |
marker: 'direct', | |
depart_date: depart_date.to_s, | |
return_date: return_date.to_s, | |
destination: @mow.iata, | |
adults: 1 | |
response.should be_redirect | |
response.headers['Location'].should include('fileName=Moscow') | |
end | |
it 'should redirect to search page if file_name not found' do | |
post :create, | |
marker: 'direct', | |
depart_date: depart_date.to_s, | |
return_date: return_date.to_s, | |
destination: 'Spb', | |
adults: 1 | |
response.should be_redirect | |
response.headers['Location'].should include('search=Spb') | |
end | |
it 'should redirect to search page with destination parameter if destination is nil' do | |
post :create, | |
marker: 'direct', | |
depart_date: depart_date.to_s, | |
return_date: return_date.to_s, | |
destination: 'Test_City', | |
adults: 1 | |
response.should be_redirect | |
response.headers['Location'].should include('search=Test_City') | |
response.headers['Location'].should_not include('fileName=') | |
end | |
it 'should redirect to file name page if destination is nil but page_name parameter is passed' do | |
post :create, | |
marker: 'direct', | |
depart_date: depart_date.to_s, | |
return_date: return_date.to_s, | |
destination: 'Test_City', | |
page_name: 'City', | |
adults: 1 | |
response.should be_redirect | |
response.headers['Location'].should_not include('search=') | |
response.headers['Location'].should include('fileName=City') | |
end | |
it 'should not set marker key and use usual host if non affiliate request' do | |
post :create, | |
marker: 'direct', | |
depart_date: depart_date.to_s, | |
return_date: return_date.to_s, | |
destination: 'Spb', | |
adults: 1 | |
response.should be_redirect | |
response.headers['Location'].should include('label=nano_roll') | |
response.headers['Location'].should_not include('label=nano_roll.direct') | |
response.headers['Location'].should include(AppConfig.hotel_host) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment