Commit e0a279d0b395cd24a236ea751e999f535f03d84f
1 parent
89a5dc27
Exists in
oauth_external_login
and in
1 other branch
Fixes failing tests
Showing
15 changed files
with
70 additions
and
68 deletions
Show diff stats
app/api/app.rb
@@ -11,7 +11,30 @@ module Api | @@ -11,7 +11,30 @@ module Api | ||
11 | mount Federation::Webfinger | 11 | mount Federation::Webfinger |
12 | end | 12 | end |
13 | 13 | ||
14 | - class BaseApi < Grape::API | 14 | + class App < Grape::API |
15 | + use Rack::JSONP | ||
16 | + | ||
17 | + logger = Logger.new(File.join(Rails.root, 'log', "#{ENV['RAILS_ENV'] || 'production'}_api.log")) | ||
18 | + logger.formatter = GrapeLogging::Formatters::Default.new | ||
19 | + #use GrapeLogging::Middleware::RequestLogger, { logger: logger } | ||
20 | + | ||
21 | + rescue_from :all do |e| | ||
22 | + logger.error e | ||
23 | + error! e.message, 500 | ||
24 | + end unless Rails.env.test? | ||
25 | + | ||
26 | + @@NOOSFERO_CONF = nil | ||
27 | + def self.NOOSFERO_CONF | ||
28 | + if @@NOOSFERO_CONF | ||
29 | + @@NOOSFERO_CONF | ||
30 | + else | ||
31 | + file = Rails.root.join('config', 'noosfero.yml') | ||
32 | + @@NOOSFERO_CONF = File.exists?(file) ? YAML.load_file(file)[Rails.env] || {} : {} | ||
33 | + end | ||
34 | + end | ||
35 | + | ||
36 | + mount NoosferoFederation | ||
37 | + | ||
15 | before { set_locale } | 38 | before { set_locale } |
16 | before { setup_multitenancy } | 39 | before { setup_multitenancy } |
17 | before { detect_stuff_by_domain } | 40 | before { detect_stuff_by_domain } |
@@ -43,31 +66,7 @@ module Api | @@ -43,31 +66,7 @@ module Api | ||
43 | mount V1::Blocks | 66 | mount V1::Blocks |
44 | mount V1::Profiles | 67 | mount V1::Profiles |
45 | mount V1::Activities | 68 | mount V1::Activities |
46 | - end | ||
47 | - | ||
48 | - class App < Grape::API | ||
49 | - use Rack::JSONP | ||
50 | - | ||
51 | - logger = Logger.new(File.join(Rails.root, 'log', "#{ENV['RAILS_ENV'] || 'production'}_api.log")) | ||
52 | - logger.formatter = GrapeLogging::Formatters::Default.new | ||
53 | - #use GrapeLogging::Middleware::RequestLogger, { logger: logger } | ||
54 | 69 | ||
55 | - rescue_from :all do |e| | ||
56 | - logger.error e | ||
57 | - error! e.message, 500 | ||
58 | - end unless Rails.env.test? | ||
59 | - | ||
60 | - @@NOOSFERO_CONF = nil | ||
61 | - def self.NOOSFERO_CONF | ||
62 | - if @@NOOSFERO_CONF | ||
63 | - @@NOOSFERO_CONF | ||
64 | - else | ||
65 | - file = Rails.root.join('config', 'noosfero.yml') | ||
66 | - @@NOOSFERO_CONF = File.exists?(file) ? YAML.load_file(file)[Rails.env] || {} : {} | ||
67 | - end | ||
68 | - end | ||
69 | - mount BaseApi | ||
70 | - mount NoosferoFederation | ||
71 | # hook point which allow plugins to add Grape::API extensions to Api::App | 70 | # hook point which allow plugins to add Grape::API extensions to Api::App |
72 | #finds for plugins which has api mount points classes defined (the class should extends Grape::API) | 71 | #finds for plugins which has api mount points classes defined (the class should extends Grape::API) |
73 | @plugins = Noosfero::Plugin.all.map { |p| p.constantize } | 72 | @plugins = Noosfero::Plugin.all.map { |p| p.constantize } |
app/api/federation/webfinger.rb
@@ -44,7 +44,7 @@ def acct_hash | @@ -44,7 +44,7 @@ def acct_hash | ||
44 | acct = Hash.new{|hash, key| hash[key] = Hash.new{|hash, key| hash[key] = Array.new}} | 44 | acct = Hash.new{|hash, key| hash[key] = Hash.new{|hash, key| hash[key] = Array.new}} |
45 | url = rails.options[:Host] + ':' + rails.options[:Port].to_s + '/' | 45 | url = rails.options[:Host] + ':' + rails.options[:Port].to_s + '/' |
46 | person = Person.find_by_identifier(extract_person_identifier) | 46 | person = Person.find_by_identifier(extract_person_identifier) |
47 | - | 47 | + |
48 | if person.nil? | 48 | if person.nil? |
49 | Rails.logger.error 'Person not found' | 49 | Rails.logger.error 'Person not found' |
50 | not_found! | 50 | not_found! |
app/api/v1/activities.rb
1 | module Api | 1 | module Api |
2 | module V1 | 2 | module V1 |
3 | class Activities < Grape::API | 3 | class Activities < Grape::API |
4 | - | 4 | + |
5 | resource :profiles do | 5 | resource :profiles do |
6 | 6 | ||
7 | get ':id/activities' do | 7 | get ':id/activities' do |
@@ -9,7 +9,7 @@ module Api | @@ -9,7 +9,7 @@ module Api | ||
9 | 9 | ||
10 | not_found! if profile.blank? || profile.secret || !profile.visible | 10 | not_found! if profile.blank? || profile.secret || !profile.visible |
11 | forbidden! if !profile.display_private_info_to?(current_person) | 11 | forbidden! if !profile.display_private_info_to?(current_person) |
12 | - | 12 | + |
13 | activities = profile.activities.map(&:activity) | 13 | activities = profile.activities.map(&:activity) |
14 | present activities, :with => Entities::Activity, :current_person => current_person | 14 | present activities, :with => Entities::Activity, :current_person => current_person |
15 | end | 15 | end |
app/api/v1/articles.rb
@@ -64,7 +64,7 @@ module Api | @@ -64,7 +64,7 @@ module Api | ||
64 | render_api_error!(_('The article couldn\'t be removed due to some problem. Please contact the administrator.'), 400) | 64 | render_api_error!(_('The article couldn\'t be removed due to some problem. Please contact the administrator.'), 400) |
65 | end | 65 | end |
66 | end | 66 | end |
67 | - | 67 | + |
68 | desc 'Report a abuse and/or violent content in a article by id' do | 68 | desc 'Report a abuse and/or violent content in a article by id' do |
69 | detail 'Submit a abuse (in general, a content violation) report about a specific article' | 69 | detail 'Submit a abuse (in general, a content violation) report about a specific article' |
70 | params Entities::Article.documentation | 70 | params Entities::Article.documentation |
app/concerns/authenticated_system.rb
@@ -27,8 +27,8 @@ module AuthenticatedSystem | @@ -27,8 +27,8 @@ module AuthenticatedSystem | ||
27 | @current_user ||= begin | 27 | @current_user ||= begin |
28 | user = nil | 28 | user = nil |
29 | if session[:external] | 29 | if session[:external] |
30 | - user = User.new #FIXME: User needs to have at least email | ||
31 | - external_person = ExternalPerson.where(id: session[:external]).last | 30 | + user = User.new |
31 | + external_person = ExternalPerson.find_by(id: session[:external]) | ||
32 | if external_person | 32 | if external_person |
33 | user.external_person_id = external_person.id | 33 | user.external_person_id = external_person.id |
34 | user.email = external_person.email | 34 | user.email = external_person.email |
@@ -36,8 +36,7 @@ module AuthenticatedSystem | @@ -36,8 +36,7 @@ module AuthenticatedSystem | ||
36 | session[:external] = nil | 36 | session[:external] = nil |
37 | end | 37 | end |
38 | else | 38 | else |
39 | - id = session[:user] | ||
40 | - user = User.where(id: id).first if id | 39 | + user = User.find_by(id: user_id) if user_id |
41 | end | 40 | end |
42 | user.session = session if user | 41 | user.session = session if user |
43 | User.current = user | 42 | User.current = user |
app/controllers/public/profile_controller.rb
@@ -398,7 +398,7 @@ class ProfileController < PublicController | @@ -398,7 +398,7 @@ class ProfileController < PublicController | ||
398 | def icon | 398 | def icon |
399 | size = params[:size] || :portrait | 399 | size = params[:size] || :portrait |
400 | image, mime = profile_icon(profile, size.to_sym, true) | 400 | image, mime = profile_icon(profile, size.to_sym, true) |
401 | - | 401 | + |
402 | unless image.match(/^\/\/www\.gravatar\.com/).nil? | 402 | unless image.match(/^\/\/www\.gravatar\.com/).nil? |
403 | redirect_to 'https:' + image | 403 | redirect_to 'https:' + image |
404 | else | 404 | else |
app/helpers/theme_loader_helper.rb
@@ -2,7 +2,7 @@ module ThemeLoaderHelper | @@ -2,7 +2,7 @@ module ThemeLoaderHelper | ||
2 | def current_theme | 2 | def current_theme |
3 | @current_theme ||= | 3 | @current_theme ||= |
4 | begin | 4 | begin |
5 | - if !(defined?(session)).nil? && session[:user_theme] | 5 | + if defined?(session).present? && session[:user_theme] |
6 | session[:user_theme] | 6 | session[:user_theme] |
7 | else | 7 | else |
8 | # utility for developers: set the theme to 'random' in development mode and | 8 | # utility for developers: set the theme to 'random' in development mode and |
@@ -34,9 +34,9 @@ module ThemeLoaderHelper | @@ -34,9 +34,9 @@ module ThemeLoaderHelper | ||
34 | end | 34 | end |
35 | 35 | ||
36 | def theme_path | 36 | def theme_path |
37 | - if !(defined?(session)).nil? && session[:user_theme] | 37 | + if defined?(session).present? && session[:user_theme] |
38 | '/user_themes/' + current_theme | 38 | '/user_themes/' + current_theme |
39 | - elsif session[:theme] | 39 | + elsif defined?(session).present? && session[:theme] |
40 | '/designs/themes/' + session[:theme] | 40 | '/designs/themes/' + session[:theme] |
41 | else | 41 | else |
42 | '/designs/themes/' + current_theme | 42 | '/designs/themes/' + current_theme |
app/models/concerns/external_user.rb
@@ -19,7 +19,7 @@ module ExternalUser | @@ -19,7 +19,7 @@ module ExternalUser | ||
19 | def webfinger_lookup(login, domain, environment) | 19 | def webfinger_lookup(login, domain, environment) |
20 | if login && domain && environment.has_federated_network?(domain) | 20 | if login && domain && environment.has_federated_network?(domain) |
21 | url = URI.parse('https://'+ domain +'/.well-known/webfinger?resource=acct:'+ | 21 | url = URI.parse('https://'+ domain +'/.well-known/webfinger?resource=acct:'+ |
22 | - login+'@'+Environment.default.external_environments.find_by_url(domain)) | 22 | + login+'@'+domain) |
23 | req = Net::HTTP::Get.new(url.to_s) | 23 | req = Net::HTTP::Get.new(url.to_s) |
24 | res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) } | 24 | res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) } |
25 | JSON.parse(res.body) | 25 | JSON.parse(res.body) |
@@ -67,26 +67,29 @@ module ExternalUser | @@ -67,26 +67,29 @@ module ExternalUser | ||
67 | 67 | ||
68 | # Authenticates a user from an external social network | 68 | # Authenticates a user from an external social network |
69 | def external_authenticate(username, password, environment) | 69 | def external_authenticate(username, password, environment) |
70 | - login, domain = username.split('@') | ||
71 | - webfinger = User.webfinger_lookup(login, domain, environment) | ||
72 | - if webfinger | ||
73 | - user = User.external_login(login, password, domain) | ||
74 | - if user | ||
75 | - u = User.new | ||
76 | - u.email = user['user']['email'] | ||
77 | - u.login = login | ||
78 | - webfinger = OpenStruct.new( | ||
79 | - identifier: webfinger['properties']['identifier'], | ||
80 | - name: webfinger['titles']['name'], | ||
81 | - created_at: webfinger['properties']['created_at'], | ||
82 | - domain: domain, | ||
83 | - email: user['user']['email'] | ||
84 | - ) | ||
85 | - u.external_person_id = ExternalPerson.get_or_create(webfinger).id | ||
86 | - return u | 70 | + if username && username.include?('@') |
71 | + login, domain = username.split('@') | ||
72 | + webfinger = User.webfinger_lookup(login, domain, environment) | ||
73 | + if webfinger | ||
74 | + user = User.external_login(login, password, domain) | ||
75 | + if user | ||
76 | + u = User.new | ||
77 | + u.email = user['user']['email'] | ||
78 | + u.login = login | ||
79 | + webfinger = OpenStruct.new( | ||
80 | + identifier: webfinger['properties']['identifier'], | ||
81 | + name: webfinger['titles']['name'], | ||
82 | + created_at: webfinger['properties']['created_at'], | ||
83 | + domain: domain, | ||
84 | + email: user['user']['email'] | ||
85 | + ) | ||
86 | + u.external_person_id = ExternalPerson.get_or_create(webfinger).id | ||
87 | + return u | ||
88 | + end | ||
87 | end | 89 | end |
88 | end | 90 | end |
89 | nil | 91 | nil |
90 | end | 92 | end |
93 | + | ||
91 | end | 94 | end |
92 | end | 95 | end |
config/routes.rb
@@ -86,7 +86,7 @@ Noosfero::Application.routes.draw do | @@ -86,7 +86,7 @@ Noosfero::Application.routes.draw do | ||
86 | 86 | ||
87 | # comments | 87 | # comments |
88 | match 'profile/:profile/comment/:action/:id', controller: 'comment', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all | 88 | match 'profile/:profile/comment/:action/:id', controller: 'comment', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all |
89 | - | 89 | + |
90 | # icon | 90 | # icon |
91 | match 'profile/:profile/icon(/:size)', controller: 'profile', action: 'icon', size: /(big|minor|thumb|portrait|icon)/, profile: /#{Noosfero.identifier_format_in_url}/i, via: :get | 91 | match 'profile/:profile/icon(/:size)', controller: 'profile', action: 'icon', size: /(big|minor|thumb|portrait|icon)/, profile: /#{Noosfero.identifier_format_in_url}/i, via: :get |
92 | 92 |
features/external_login.feature
@@ -6,7 +6,7 @@ Feature: external login | @@ -6,7 +6,7 @@ Feature: external login | ||
6 | @selenium | 6 | @selenium |
7 | Scenario: login from portal homepage | 7 | Scenario: login from portal homepage |
8 | Given feature "allow_change_of_redirection_after_login" is disabled on environment | 8 | Given feature "allow_change_of_redirection_after_login" is disabled on environment |
9 | - And the following federated networks | 9 | + And the following external environments |
10 | | identifier | name | url | | 10 | | identifier | name | url | |
11 | | test | Test | http://federated.noosfero.org | | 11 | | test | Test | http://federated.noosfero.org | |
12 | And the following external users | 12 | And the following external users |
@@ -25,7 +25,7 @@ Feature: external login | @@ -25,7 +25,7 @@ Feature: external login | ||
25 | @selenium | 25 | @selenium |
26 | Scenario: not login from portal homepage | 26 | Scenario: not login from portal homepage |
27 | Given feature "allow_change_of_redirection_after_login" is disabled on environment | 27 | Given feature "allow_change_of_redirection_after_login" is disabled on environment |
28 | - And the following federated networks | 28 | + And the following external environments |
29 | | identifier | name | url | | 29 | | identifier | name | url | |
30 | | test | Test | http://federated.noosfero.org | | 30 | | test | Test | http://federated.noosfero.org | |
31 | And I am not logged in | 31 | And I am not logged in |
plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb
@@ -173,6 +173,7 @@ class OrganizationRatingsPluginProfileControllerTest < ActionController::TestCas | @@ -173,6 +173,7 @@ class OrganizationRatingsPluginProfileControllerTest < ActionController::TestCas | ||
173 | 173 | ||
174 | logout | 174 | logout |
175 | @controller.stubs(:logged_in?).returns(false) | 175 | @controller.stubs(:logged_in?).returns(false) |
176 | + @controller.stubs(:current_user).returns(nil) | ||
176 | 177 | ||
177 | get :new_rating, profile: @community.identifier | 178 | get :new_rating, profile: @community.identifier |
178 | assert_no_tag :tag => 'p', :content => /Report waiting for approval/, :attributes => {:class =>/comment-rejected-msg/} | 179 | assert_no_tag :tag => 'p', :content => /Report waiting for approval/, :attributes => {:class =>/comment-rejected-msg/} |
plugins/organization_ratings/views/shared/_make_report_block.html.erb
1 | <% logged_in_image = link_to profile_image(current_person, :portrait), current_person.url if current_user %> | 1 | <% logged_in_image = link_to profile_image(current_person, :portrait), current_person.url if current_user %> |
2 | <% logged_in_name = link_to current_person.name, current_person.url if current_user %> | 2 | <% logged_in_name = link_to current_person.name, current_person.url if current_user %> |
3 | -<% logged_out_image = image_tag('plugins/organization_ratings/images/user-not-logged.png') %> | 3 | +<% logged_out_image = image_tag('plugins/organization_ratings/public/images/user-not-logged.png') %> |
4 | 4 | ||
5 | <div class="make-report-block"> | 5 | <div class="make-report-block"> |
6 | <div class="star-profile-information"> | 6 | <div class="star-profile-information"> |
test/api/federation/webfinger_test.rb
@@ -4,7 +4,7 @@ class WebfingerTest < ActiveSupport::TestCase | @@ -4,7 +4,7 @@ class WebfingerTest < ActiveSupport::TestCase | ||
4 | def setup | 4 | def setup |
5 | Domain.create(name: 'example.com') | 5 | Domain.create(name: 'example.com') |
6 | Environment.default.domains << Domain.last | 6 | Environment.default.domains << Domain.last |
7 | - User.create(login: 'ze', email: 'ze@localdomain.localdomain', | 7 | + User.create(login: 'ze', email: 'ze@localdomain.localdomain', |
8 | password: 'zeze', password_confirmation: 'zeze') | 8 | password: 'zeze', password_confirmation: 'zeze') |
9 | end | 9 | end |
10 | 10 |
test/api/people_test.rb
@@ -376,7 +376,7 @@ class PeopleTest < ActiveSupport::TestCase | @@ -376,7 +376,7 @@ class PeopleTest < ActiveSupport::TestCase | ||
376 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}" | 376 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}" |
377 | assert_equal 200, last_response.status | 377 | assert_equal 200, last_response.status |
378 | json = JSON.parse(last_response.body) | 378 | json = JSON.parse(last_response.body) |
379 | - assert_match /^https?:\/\/.*portrait\.png$/, json['icon'] | 379 | + assert_match(/^https?:\/\/.*portrait\.png$/, json['icon']) |
380 | end | 380 | end |
381 | 381 | ||
382 | should 'return icon in provided size if there is a profile image' do | 382 | should 'return icon in provided size if there is a profile image' do |
@@ -386,7 +386,7 @@ class PeopleTest < ActiveSupport::TestCase | @@ -386,7 +386,7 @@ class PeopleTest < ActiveSupport::TestCase | ||
386 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}&size=big" | 386 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}&size=big" |
387 | assert_equal 200, last_response.status | 387 | assert_equal 200, last_response.status |
388 | json = JSON.parse(last_response.body) | 388 | json = JSON.parse(last_response.body) |
389 | - assert_match /^https?:\/\/.*big\.png$/, json['icon'] | 389 | + assert_match(/^https?:\/\/.*big\.png$/, json['icon']) |
390 | end | 390 | end |
391 | 391 | ||
392 | should 'return icon from gravatar without size if there is no profile image' do | 392 | should 'return icon from gravatar without size if there is no profile image' do |
@@ -395,7 +395,7 @@ class PeopleTest < ActiveSupport::TestCase | @@ -395,7 +395,7 @@ class PeopleTest < ActiveSupport::TestCase | ||
395 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}" | 395 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}" |
396 | assert_equal 200, last_response.status | 396 | assert_equal 200, last_response.status |
397 | json = JSON.parse(last_response.body) | 397 | json = JSON.parse(last_response.body) |
398 | - assert_match /^https:\/\/www\.gravatar\.com.*size=64/, json['icon'] | 398 | + assert_match(/^https:\/\/www\.gravatar\.com.*size=64/, json['icon']) |
399 | end | 399 | end |
400 | 400 | ||
401 | should 'return icon from gravatar with size if there is no profile image' do | 401 | should 'return icon from gravatar with size if there is no profile image' do |
@@ -404,7 +404,7 @@ class PeopleTest < ActiveSupport::TestCase | @@ -404,7 +404,7 @@ class PeopleTest < ActiveSupport::TestCase | ||
404 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}&size=big" | 404 | get "/api/v1/people/#{profile.id}/icon?#{params.to_query}&size=big" |
405 | assert_equal 200, last_response.status | 405 | assert_equal 200, last_response.status |
406 | json = JSON.parse(last_response.body) | 406 | json = JSON.parse(last_response.body) |
407 | - assert_match /^https:\/\/www\.gravatar\.com.*size=150/, json['icon'] | 407 | + assert_match(/^https:\/\/www\.gravatar\.com.*size=150/, json['icon']) |
408 | end | 408 | end |
409 | 409 | ||
410 | PERSON_ATTRIBUTES = %w(vote_count comments_count articles_count following_articles_count) | 410 | PERSON_ATTRIBUTES = %w(vote_count comments_count articles_count following_articles_count) |
test/functional/profile_controller_test.rb
@@ -1935,7 +1935,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1935,7 +1935,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1935 | should 'return portrait icon if size is not provided and there is a profile image' do | 1935 | should 'return portrait icon if size is not provided and there is a profile image' do |
1936 | img = Image.create!(uploaded_data: fixture_file_upload('/files/rails.png', 'image/png')) | 1936 | img = Image.create!(uploaded_data: fixture_file_upload('/files/rails.png', 'image/png')) |
1937 | profile = fast_create(Person, image_id: img.id) | 1937 | profile = fast_create(Person, image_id: img.id) |
1938 | - | 1938 | + |
1939 | get :icon, profile: profile.identifier, size: nil | 1939 | get :icon, profile: profile.identifier, size: nil |
1940 | assert_response :success | 1940 | assert_response :success |
1941 | assert_equal 'image/png', @response.header['Content-Type'] | 1941 | assert_equal 'image/png', @response.header['Content-Type'] |
@@ -1945,7 +1945,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1945,7 +1945,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1945 | should 'return icon in provided size if there is a profile image' do | 1945 | should 'return icon in provided size if there is a profile image' do |
1946 | img = Image.create!(uploaded_data: fixture_file_upload('/files/rails.png', 'image/png')) | 1946 | img = Image.create!(uploaded_data: fixture_file_upload('/files/rails.png', 'image/png')) |
1947 | profile = fast_create(Person, image_id: img.id) | 1947 | profile = fast_create(Person, image_id: img.id) |
1948 | - | 1948 | + |
1949 | get :icon, profile: profile.identifier, size: :big | 1949 | get :icon, profile: profile.identifier, size: :big |
1950 | assert_response :success | 1950 | assert_response :success |
1951 | assert_equal 'image/png', @response.header['Content-Type'] | 1951 | assert_equal 'image/png', @response.header['Content-Type'] |
@@ -1954,14 +1954,14 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1954,14 +1954,14 @@ class ProfileControllerTest < ActionController::TestCase | ||
1954 | 1954 | ||
1955 | should 'return icon from gravatar without size if there is no profile image' do | 1955 | should 'return icon from gravatar without size if there is no profile image' do |
1956 | profile = fast_create(Person) | 1956 | profile = fast_create(Person) |
1957 | - | 1957 | + |
1958 | get :icon, profile: profile.identifier | 1958 | get :icon, profile: profile.identifier |
1959 | assert_redirected_to /^https:\/\/www\.gravatar\.com\/.*/ | 1959 | assert_redirected_to /^https:\/\/www\.gravatar\.com\/.*/ |
1960 | end | 1960 | end |
1961 | 1961 | ||
1962 | should 'return icon from gravatar with size if there is no profile image' do | 1962 | should 'return icon from gravatar with size if there is no profile image' do |
1963 | profile = fast_create(Person) | 1963 | profile = fast_create(Person) |
1964 | - | 1964 | + |
1965 | get :icon, profile: profile.identifier, size: :thumb | 1965 | get :icon, profile: profile.identifier, size: :thumb |
1966 | assert_redirected_to /^https:\/\/www\.gravatar\.com\/.*/ | 1966 | assert_redirected_to /^https:\/\/www\.gravatar\.com\/.*/ |
1967 | end | 1967 | end |