diff --git a/db/up/scores_better_test_data.sql b/db/up/scores_better_test_data.sql
index 52a8e9842..0f5935cc6 100644
--- a/db/up/scores_better_test_data.sql
+++ b/db/up/scores_better_test_data.sql
@@ -86,10 +86,10 @@ CREATE OR REPLACE FUNCTION generate_scores_dataset () RETURNS VOID STRICT VOLATI
INSERT INTO cities (city, region, countrycode) select distinct city, region, countrycode from geoiplocations where length(city) > 0 and length(countrycode) > 0;
DELETE FROM regions;
- INSERT INTO regions (region, countrycode) select distinct region, countrycode from cities;
+ INSERT INTO regions (region, regionname, countrycode) select distinct region, region, countrycode from cities;
DELETE FROM countries;
- INSERT INTO countries (countrycode) select distinct countrycode from regions;
+ INSERT INTO countries (countrycode, countryname) select distinct countrycode, countrycode from regions;
END IF;
RETURN;
diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb
index 8859fcbe4..242a658ef 100644
--- a/web/app/controllers/users_controller.rb
+++ b/web/app/controllers/users_controller.rb
@@ -463,6 +463,9 @@ JS
end
def load_location(remote_ip, location = nil)
+ # useful if you need to repro something on 127.0.0.1
+ # remote_ip = ' 23.119.29.89'
+
@location = location
if @location.nil?
@@ -471,7 +474,6 @@ JS
@location[:country] = "US" if @location[:country].nil?
- # right now we only accept US signups for beta
@countriesx = MaxMindManager.countries
# populate regions based on current country
@regions = MaxMindManager.regions(@location[:country])
diff --git a/web/app/views/users/new.html.erb b/web/app/views/users/new.html.erb
index ffce472cd..83f79f482 100644
--- a/web/app/views/users/new.html.erb
+++ b/web/app/views/users/new.html.erb
@@ -55,7 +55,7 @@
<% @regions.each do |region| %>
<% unless region.blank? %>
-
+
<% end %>
<% end %>
diff --git a/web/spec/features/signup_spec.rb b/web/spec/features/signup_spec.rb
index f8f223cf4..22533ac61 100644
--- a/web/spec/features/signup_spec.rb
+++ b/web/spec/features/signup_spec.rb
@@ -7,12 +7,21 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
before(:each) do
@mac_client = FactoryGirl.create(:artifact_update)
UserMailer.deliveries.clear
+ MaxMindManager.create_phony_database
end
describe "signup page" do
before { visit signup_path }
- it { should have_selector('h2', text: 'Create a JamKazam account') }
+ it "should initialize successfully" do
+ should have_selector('h2', text: 'Create a JamKazam account')
+
+ # we should see these locations in the signup form already chosen
+ location = GeoIpLocations.lookup('127.0.0.1')
+ find('.field.country .easydropdown .selected', text:location[:country])
+ find('.field.state .easydropdown .selected', text:location[:state])
+ find('.field.city .easydropdown .selected', text:location[:city])
+ end
describe "with valid musician information" do
before do
@@ -30,7 +39,12 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
it {
should have_title("JamKazam | Congratulations")
should have_content("You have successfully registered as a JamKazam musician.")
- User.find_by_email('newuser1@jamkazam.com').musician_instruments.length.should == 1
+ user = User.find_by_email('newuser1@jamkazam.com')
+ user.musician_instruments.length.should == 1
+ location = GeoIpLocations.lookup('127.0.0.1')
+ user.country.should == location[:country]
+ user.state.should == location[:state]
+ user.city.should == location[:city]
# an email is sent on no-invite signup
UserMailer.deliveries.length.should == 1
UserMailer.deliveries[0].html_part.body.include?("To confirm this email address")== 1