Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fork of Audited gem #55

Merged
merged 1 commit into from
Nov 6, 2019
Merged
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 Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ gem 'devise'

gem 'aasm'

gem 'audited'
gem 'audited', git: 'git@github.com:james/audited.git', branch: 'southwark'

# Used by seeds.rb
gem 'faker', git: 'https://github.com/faker-ruby/faker.git', branch: 'master'
Expand Down
12 changes: 9 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GIT
remote: git@github.com:james/audited.git
revision: dc144779bff52561f18968f1ca2a9d3eff20d6c0
branch: southwark
specs:
audited (4.9.0)
activerecord (>= 4.2, < 6.1)

GIT
remote: https://github.com/faker-ruby/faker.git
revision: 4ba30fb28072e942420ebf2d58da73969ae6159b
Expand Down Expand Up @@ -69,8 +77,6 @@ GEM
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.0)
audited (4.9.0)
activerecord (>= 4.2, < 6.1)
bcrypt (3.1.13)
bindex (0.8.1)
bootsnap (1.4.5)
Expand Down Expand Up @@ -291,7 +297,7 @@ PLATFORMS

DEPENDENCIES
aasm
audited
audited!
bootsnap (>= 1.4.2)
byebug
capybara (>= 2.15)
Expand Down
9 changes: 0 additions & 9 deletions app/models/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,4 @@ def completion_response_filled?
def set_developer_access_key
self.developer_access_key = SecureRandom.urlsafe_base64(20)
end

def comment_required_state?
# Monkey patch explanation:
# The Audited gem doesn't create a changelog if there are no audited_changes
# eg in the situation where we're only changing `state`, and state is ignored by
# audited. So in this situation, we shouldn't require a comment either.
# TODO: Make this a PR on the audited gem itself
super && audited_changes.present?
end
end
12 changes: 0 additions & 12 deletions app/models/dwelling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,4 @@ class Dwelling < ApplicationRecord
validates :bedrooms, presence: true

delegate :audit_changes?, to: :development

private

def comment_required_state?
# Monkey patch explanation:
# The Audited gem doesn't create a changelog if there are no audited_changes
# eg in the situation where we're only changing `address`, and address is
# ignored by audited. So in this situation, we shouldn't require a comment
# either.
# TODO: Make this a PR on the audited gem itself
super && audited_changes.present?
end
end
2 changes: 1 addition & 1 deletion spec/features/creating_dwellings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@
click_link 'Add a new dwelling'
fill_in 'Changelog', with: ''
click_button 'Add dwelling'
expect(page).to have_content("Audit comment Comment can't be blank")
expect(page).to have_content("Audit comment can't be blank")
end
end
2 changes: 1 addition & 1 deletion spec/features/deleting_dwellings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
click_link 'Delete dwelling'
fill_in 'Deletion reason', with: ''
click_button 'Delete dwelling'
expect(page).to have_content("Audit comment Comment can't be blank")
expect(page).to have_content("Audit comment can't be blank")
end
end
2 changes: 1 addition & 1 deletion spec/features/editing_developments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
fill_in 'Proposal', with: 'Build a building edited'
fill_in 'Changelog', with: ''
click_button 'Save and continue'
expect(page).to have_content("Audit comment Comment can't be blank")
expect(page).to have_content("Audit comment can't be blank")
end

scenario 'unable to view if not logged in' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/editing_dwellings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@
select 'social', from: 'Tenure'
fill_in 'Changelog', with: ''
click_button 'Save dwelling'
expect(page).to have_content("Audit comment Comment can't be blank")
expect(page).to have_content("Audit comment can't be blank")
end
end