@@ -7,7 +7,7 @@ module Mappable
|
||||
has_one :map_location, dependent: :destroy
|
||||
accepts_nested_attributes_for :map_location, allow_destroy: true
|
||||
|
||||
validate :map_must_be_valid, if: :feature_maps?
|
||||
validate :map_must_be_valid, on: :create, if: :feature_maps?
|
||||
|
||||
def map_must_be_valid
|
||||
return true if skip_map?
|
||||
|
||||
16
lib/tasks/votes.rake
Normal file
16
lib/tasks/votes.rake
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace :votes do
|
||||
|
||||
desc "Resets cached_votes_up counter to its latest value"
|
||||
task reset_vote_counter: :environment do
|
||||
models = [Proposal, Budget::Investment]
|
||||
|
||||
models.each do |model|
|
||||
model.find_each do |resource|
|
||||
resource.update_cached_votes
|
||||
print "."
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -175,22 +175,22 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
|
||||
expect(page).not_to have_css(".map_location")
|
||||
end
|
||||
|
||||
scenario 'Errors on update', :js do
|
||||
scenario 'No errors on update', :js do
|
||||
skip ""
|
||||
login_as mappable.author
|
||||
|
||||
visit send(mappable_edit_path, id: mappable.id)
|
||||
click_link "Remove map marker"
|
||||
click_on "Save changes"
|
||||
|
||||
expect(page).to have_content "Map location can't be blank"
|
||||
expect(page).to_not have_content "Map location can't be blank"
|
||||
end
|
||||
|
||||
scenario 'Skip map on update' do
|
||||
scenario 'No need to skip map on update' do
|
||||
login_as mappable.author
|
||||
|
||||
visit send(mappable_edit_path, id: mappable.id)
|
||||
click_link "Remove map marker"
|
||||
check "#{mappable_factory_name}_skip_map"
|
||||
click_on "Save changes"
|
||||
|
||||
expect(page).to_not have_content "Map location can't be blank"
|
||||
|
||||
Reference in New Issue
Block a user