diff --git a/app/assets/stylesheets/themes/default/layout/_header.scss b/app/assets/stylesheets/themes/default/layout/_header.scss
index ab4efe6..0c86cb9 100644
--- a/app/assets/stylesheets/themes/default/layout/_header.scss
+++ b/app/assets/stylesheets/themes/default/layout/_header.scss
@@ -136,8 +136,8 @@ header .banner {
}
.register {
- @include span-columns(5 of 12);
- @include shift(-1);
+ @include span-columns(4 of 12);
+ @include shift(0.1);
.password-reset {
float: right;
diff --git a/app/models/user.rb b/app/models/user.rb
index 3509f2a..6da21e4 100755
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -134,7 +134,7 @@ class User < ActiveRecord::Base
before_validation :update_password
- validates_uniqueness_of :username, :email, :steamid
+ validates_uniqueness_of :username, :email, :steamid, :case_sensitive => false
validates_length_of :firstname, :in => 1..15, :allow_blank => true
validates_length_of :lastname, :in => 1..25, :allow_blank => true
validates_length_of :username, :in => 1..30
@@ -454,7 +454,7 @@ class User < ActiveRecord::Base
end
def self.authenticate(login)
- user = where('username = ?', login[:username]).first
+ user = where('lower(username) = ?', login[:username].downcase).first
return nil unless user
begin
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 758b66b..d6ca82c 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -34,4 +34,6 @@ Rails.application.configure do
config.active_support.deprecation = :stderr
config.eager_load = true
+
+ config.assets.compile = true
end
diff --git a/spec/factories/user.rb b/spec/factories/user.rb
index 1d4e6e3..5cb30b2 100755
--- a/spec/factories/user.rb
+++ b/spec/factories/user.rb
@@ -10,10 +10,6 @@ FactoryBot.define do
raw_password "PasswordABC123"
# lastvisit "Sun, 15 Mar 2020 13:31:06 +0000"
- after(:create) do |user|
- create(:profile, user: user)
- end
-
trait :admin do
after(:create) do |user|
group = create(:group, :admin)
diff --git a/spec/features/users/case_insensitive_login_spec.rb b/spec/features/users/case_insensitive_login_spec.rb
index 6073b21..b1bf0cc 100755
--- a/spec/features/users/case_insensitive_login_spec.rb
+++ b/spec/features/users/case_insensitive_login_spec.rb
@@ -12,7 +12,7 @@ feature "Case insensitive login", js: :true do
feature "when a user with mixed-case username signs in" do
scenario "with a matching case allows the user to sign in" do
fill_login_form(username)
- find('.login input').trigger('click')
+ find('#authentication input[name="commit"]').trigger('click')
expect(page).to have_content(I18n.t("login_successful"))
@@ -23,7 +23,7 @@ feature "Case insensitive login", js: :true do
scenario "with a non-matching case allows the user to sign in" do
fill_login_form("CASE_INSENSITIVE")
- find('.login input').trigger('click')
+ find('#authentication input[name="commit"]').trigger('click')
expect(page).to have_content(I18n.t("login_successful"))
diff --git a/spec/features/users/stream_spec.rb b/spec/features/users/stream_spec.rb
index 18733e1..787341e 100755
--- a/spec/features/users/stream_spec.rb
+++ b/spec/features/users/stream_spec.rb
@@ -8,13 +8,18 @@ feature "User Stream Information" do
scenario "user updates their stream" do
visit user_path(user)
expect(page.html).to_not include("
Stream")
+
sign_in_as(user)
+
visit edit_user_path(user)
stream_url = "twitch.tv/gold_n"
expect(page).to have_content("Stream")
+
fill_in "user_profile_attributes_stream", with: stream_url
click_button "Update Profile"
+
expect(page).to have_content(I18n.t(:users_update))
+
visit user_path(user)
expect(page.html).to include("Stream")
expect(page).to have_content(stream_url)
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index cd3b49e..d3668e5 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -46,6 +46,7 @@ RSpec.configure do |config|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
+ # DEBUG: set to false
config.use_transactional_fixtures = true
# RSpec Rails can automatically mix in different behaviours to your tests
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index bbba6bc..03d82cd 100755
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,5 +1,8 @@
ENV["RAILS_ENV"] ||= "test"
+# DEBUG use this
+# require 'pry-byebug'
+
require 'dotenv'
Dotenv.load('.env.' + ENV['RAILS_ENV'] + '.local', '.env.local', '.env.' + ENV['RAILS_ENV'], '.env')
@@ -26,22 +29,22 @@ end
Capybara.javascript_driver = :poltergeist
-SELENIUM_HOST = ENV['SELENIUM_HOST']
-TEST_APP_HOST = ENV['TEST_APP_HOST']
-TEST_APP_PORT = ENV['TEST_APP_PORT']
+# SELENIUM_HOST = ENV['SELENIUM_HOST']
+# TEST_APP_HOST = ENV['TEST_APP_HOST']
+# TEST_APP_PORT = ENV['TEST_APP_PORT']
-Capybara.server_port = TEST_APP_PORT
-Capybara.server_host = '0.0.0.0'
-Capybara.app_host = "http://#{TEST_APP_HOST}:#{TEST_APP_PORT}"
-Capybara.register_driver :selenium_remote do |app|
- Capybara::Selenium::Driver.new(
- app,
- browser: :remote,
- url: "http://#{SELENIUM_HOST}:4444/wd/hub",
- desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome
- )
-end
-Capybara.default_max_wait_time = 8
+# Capybara.server_port = TEST_APP_PORT
+# Capybara.server_host = '0.0.0.0'
+# Capybara.app_host = "http://#{TEST_APP_HOST}:#{TEST_APP_PORT}"
+# Capybara.register_driver :selenium_remote do |app|
+# Capybara::Selenium::Driver.new(
+# app,
+# browser: :remote,
+# url: "http://#{SELENIUM_HOST}:4444/wd/hub",
+# desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome
+# )
+# end
+# Capybara.default_max_wait_time = 8
# Capybara.javascript_driver = :selenium
# Capybara.javascript_driver = :selenium_remote
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb
index 0f0e1cd..edc39d4 100644
--- a/spec/support/database_cleaner.rb
+++ b/spec/support/database_cleaner.rb
@@ -1,6 +1,9 @@
RSpec.configure do |config|
config.before(:suite) do
- DatabaseCleaner.clean_with(:truncation)
+ DatabaseCleaner.clean_with(
+ :truncation,
+ except: %w(ar_internal_metadata)
+ )
end
config.before(:each) do
diff --git a/spec/support/features/session_helpers.rb b/spec/support/features/session_helpers.rb
index bc76401..9d97b69 100755
--- a/spec/support/features/session_helpers.rb
+++ b/spec/support/features/session_helpers.rb
@@ -3,18 +3,19 @@ module Features
def sign_in_as(user)
visit root_path
- fill_in "login_username", with: user.username
+ find_field("login_username").set(user.username)
fill_in "login_password", with: user.raw_password
+ # Apparently poltergeist does not suppor this
+ find('#authentication input[name="commit"]').click()
# click_button I18n.t("helpers.submit.user.login")
- find('#authentication .login input').trigger('click')
+
expect(page).to have_content(I18n.t('login_successful'))
end
def sign_out
visit root_path
-
- # click_button I18n.t("helpers.submit.user.login")
+
find('a#logout').trigger('click')
expect(page).to have_content(I18n.t('login_out'))
end
@@ -24,7 +25,7 @@ module Features
click_link I18n.t("profile.locals")
find("option[value='#{timezone}']").select_option
-
+
click_button I18n.t("helpers.submit.user.update")
end