Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Edit < ApplicationRecord
scope :for_target, ->(target) { where(target_type: target.class.to_s, target_id: target.id) }
scope :for_editor, ->(editor) { where(account_id: editor.id) }
scope :for_ip, ->(ip) { where(ip: ip) }
filterable_by %w[key value]
filterable_by %w[key value target_type]

def previous_value
previous_edit.try(:value)
Expand Down
8 changes: 8 additions & 0 deletions test/controllers/edits_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ class EditsControllerTest < ActionController::TestCase
end
end

it 'index should find rss subscription edits by searching target_type' do
login_as nil
rss_edit = CreateEdit.where(target_type: 'RssSubscription', project_id: @project.id).first
get :index, params: { project_id: @project.to_param, query: 'rsssubscription' }
assert_response :ok
assert assigns(:edits).map(&:id).include?(rss_edit.id)
end

# update action
it 'undo should require a logged in user' do
login_as nil
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/edits_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EditsHelperTest < ActionView::TestCase
it 'drop the year if it was this year' do
other_time = 17.days.ago
dont_fail_around_new_years_date = Time.new(Time.current.year, other_time.month, other_time.day).in_time_zone
_(edit_humanize_datetime(dont_fail_around_new_years_date)).wont_match Time.current.year
_(edit_humanize_datetime(dont_fail_around_new_years_date)).wont_match Time.current.year.to_s
end

it 'includes the year if it was before this year' do
Expand Down
Loading