Skip to content

Commit

Permalink
Merge branch 'release/0.17.12.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
kalashnikovisme committed May 15, 2017
2 parents 22ae66d + 7d4c6ca commit 7698384
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/models/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ class Subscription < ActiveRecord::Base
scope :news, -> { where record_type: 'News' }
scope :articles, -> { where record_type: 'Article' }
scope :empty, -> { active.where tag_type: :link, target_id: nil }

validates :subscription_type, uniqueness: { scope: [:receiver_id, :receiver_type] }
end
1 change: 1 addition & 0 deletions bin/generates/subscriptions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Subscription.delete_all
count = Delivery::ContactEmail.count + User.count
[Delivery::ContactEmail, User].each do |receivers|
receivers.find_each.with_index do |receiver, index|
Expand Down
2 changes: 1 addition & 1 deletion test/checks/check_subcriptions_token_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CheckSubscriptionsTokenTest < ActionController::TestCase
count = users.count
users.each_with_index do |user, index|
print "#{index} of #{count}\r"
assert user.subscribe_token
assert user.subscribe_token, user.id
end
end
end
3 changes: 2 additions & 1 deletion test/controllers/web/admin/members_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Web::Admin::MembersControllerTest < ActionController::TestCase
admin = create :admin
sign_in admin
@member = create :member
@exceptions_attributes = ['id', 'created_at', 'updated_at', 'password_digest', 'avatar', 'birth_date', 'user_id']
@exceptions_attributes = ['id', 'created_at', 'updated_at', 'password_digest', 'avatar', 'birth_date', 'user_id', 'gender']
end

test 'should get index' do
Expand Down Expand Up @@ -57,6 +57,7 @@ class Web::Admin::MembersControllerTest < ActionController::TestCase
member.attributes.keys.except(*@exceptions_attributes).each do |key|
assert_equal attributes[key.to_sym].to_s, member.send(key).to_s, key
end
assert_equal GenderHelper.detect_gender(member.first_name).to_s, member.gender
end

test 'should get edit' do
Expand Down
3 changes: 2 additions & 1 deletion test/controllers/web/admin/questionaries_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Web::Admin::QuestionariesControllerTest < ActionController::TestCase
sign_in admin
create :member
@questionary = create :questionary
@exceptions_attributes = ['id', 'created_at', 'updated_at', 'password_digest', 'birth_date', 'avatar']
@exceptions_attributes = ['id', 'created_at', 'updated_at', 'password_digest', 'birth_date', 'avatar', 'gender']
create :position_corporative_lead
end

Expand Down Expand Up @@ -53,6 +53,7 @@ class Web::Admin::QuestionariesControllerTest < ActionController::TestCase
questionary.attributes.keys.except(*@exceptions_attributes).each do |key|
assert_equal attributes[key.to_sym], questionary.send(key), key
end
assert_equal GenderHelper.detect_gender(questionary.first_name).to_s, questionary.gender
end

test 'should get edit' do
Expand Down
5 changes: 3 additions & 2 deletions test/controllers/web/admin/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Web::Admin::UsersControllerTest < ActionController::TestCase
admin = create :admin
sign_in admin
@user = create :user
@exceptions_attributes = ['id', 'created_at', 'updated_at']
@exceptions_attributes = ['id', 'created_at', 'updated_at', 'gender', 'password_digest', 'avatar']
end

test 'should get new' do
Expand Down Expand Up @@ -42,9 +42,10 @@ class Web::Admin::UsersControllerTest < ActionController::TestCase
assert_response :redirect, @response.body
assert_redirected_to admin_users_path
user = User.last
user.attributes.keys.except('id', 'created_at', 'updated_at', 'password_digest', 'avatar').each do |key|
user.attributes.keys.except(*@exceptions_attributes).each do |key|
assert_equal attributes[key.to_sym], user.send(key), key
end
assert_equal GenderHelper.detect_gender(user.first_name).to_s, user.gender
end

test 'should get edit' do
Expand Down
5 changes: 4 additions & 1 deletion test/controllers/web/welcome_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Web::WelcomeControllerTest < ActionController::TestCase
setup do
@time_quantum = 1.second
@time_quantum = 1.2.second
end

test 'should get index' do
Expand All @@ -19,14 +19,17 @@ class Web::WelcomeControllerTest < ActionController::TestCase
end

test 'should get index 100 times' do
t = 0.second
100.times do |i|
time = Time.now
get :index
duration = Time.now - time
assert duration < @time_quantum, duration
assert_response :success, @response.body
t = duration if duration
print "#{i} of 100\r"
end
puts t
end

test 'should get index with authorized user' do
Expand Down

0 comments on commit 7698384

Please sign in to comment.