font-size: 12px;
border: 1px solid $grey;
border-radius: 4px 4px 0 0;
- background-color: #F6F6F6;
+ background-color: $offwhite;
}
p {
}
.browse-tag-list {
- background-color: #F6F6F6;
+ background-color: $offwhite;
border: 1px solid $grey;
border-radius: 3px;
table-layout: fixed;
.browse-tag-k {
font-weight: 500;
- background-color: #F6F6F6;
+ background-color: $offwhite;
}
.browse-tag-v {
<% if @user %>
<% if @user == current_user %>
- <div>
- <li><%= link_to image_tag("new.png", :class => "small_icon", :border => 0) + t(".new"), new_diary_entry_path, :title => t(".new_title") %></li>
- </div>
+ <li><%= link_to image_tag("new.png", :class => "small_icon") + t(".new"), new_diary_entry_path, :title => t(".new_title") %></li>
<% end %>
<% else %>
<% if current_user %>
- <div>
- <li><%= link_to image_tag("new.png", :class => "small_icon", :border => 0) + t(".new"), new_diary_entry_path, :title => t(".new_title") %></li>
- </div>
+ <li><%= link_to image_tag("new.png", :class => "small_icon") + t(".new"), new_diary_entry_path, :title => t(".new_title") %></li>
<% end %>
<% end %>
</ul>
def self.ip_to_country(ip_address)
ipinfo = maxmind_database.lookup(ip_address) if Settings.key?(:maxmind_database)
- if ipinfo&.found?
- country = ipinfo.country.iso_code
- else
- country = http_client.get("https://api.hostip.info/country.php?ip=#{ip_address}").body
- country = "GB" if country == "UK"
- end
+ return ipinfo.country.iso_code if ipinfo&.found?
- country
- rescue StandardError
nil
end
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :poltergeist, :screen_size => [1400, 1400], :options => { :timeout => 120 }
- def initialize(*args)
- stub_request(:get, "https://api.hostip.info/country.php?ip=127.0.0.1")
- .to_return(:status => 404)
- super(*args)
- end
-
# Phantomjs can pick up browser Accept-Language preferences from your desktop environment.
# We don't want this to happen during the tests!
setup do
module Api
class UsersControllerTest < ActionController::TestCase
- def setup
- super
-
- stub_hostip_requests
- end
-
##
# test all routes which lead to this controller
def test_routes
Settings.id_key = create(:client_application).key
Settings.potlatch2_key = create(:client_application).key
-
- stub_hostip_requests
end
##
require "test_helper"
class UsersControllerTest < ActionController::TestCase
- def setup
- super
-
- stub_hostip_requests
- end
-
##
# test all routes which lead to this controller
def test_routes
class OAuthTest < ActionDispatch::IntegrationTest
include OAuth::Helper
- def setup
- stub_hostip_requests
- end
-
def test_oauth10_web_app
client = create(:client_application, :callback_url => "http://some.web.app.example.org/callback", :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true)
class PageLocaleTest < ActionDispatch::IntegrationTest
def setup
I18n.locale = "en"
- stub_hostip_requests
end
def teardown
OmniAuth.config.test_mode = true
stub_request(:get, /.*gravatar.com.*d=404/).to_return(:status => 404)
- stub_hostip_requests
end
def teardown
require "test_helper"
class UserTermsSeenTest < ActionDispatch::IntegrationTest
- def setup
- stub_hostip_requests
- end
-
def test_api_blocked
user = create(:user, :terms_seen => false, :terms_agreed => nil)
stub_request(:get, url).and_return(:status => status, :body => body)
end
- def stub_hostip_requests
- # Controller tests and integration tests use different IPs
- stub_request(:get, "https://api.hostip.info/country.php?ip=0.0.0.0")
- stub_request(:get, "https://api.hostip.info/country.php?ip=127.0.0.1")
- end
-
def email_text_parts(message)
message.parts.each_with_object([]) do |part, text_parts|
if part.content_type.start_with?("text/")
end
def sign_in_as(user)
- stub_hostip_requests
visit login_path
fill_in "username", :with => user.email
fill_in "password", :with => "test"