Skip to content

Commit

Permalink
Fix for bug where inset maps were getting the same status as the orig…
Browse files Browse the repository at this point in the history
…inal map and causing errors with the layers
  • Loading branch information
timwaters committed Jul 23, 2015
1 parent 8802ed4 commit 4d48978
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ def create_inset
inset_map.filename = File.join(maps_dir, unique_id) + ".tif"
FileUtils.copy(self.filename, inset_map.filename)

inset_map.status = :available
inset_map.mask_status = :unmasked
inset_map.rectified_at = nil

inset_map.layers = self.layers

inset_map.uuid = unique_id
Expand Down
13 changes: 13 additions & 0 deletions test/models/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,17 @@ def teardown
assert_nil @inset_map.create_inset
end

test "should not copy the status to an inset map" do
assert_not_equal @map.status, @inset_map.status
end

test "an inset map should be unmasked" do
assert_equal :unmasked, @inset_map.mask_status
end

test "an inset map should be unrectified" do
assert_equal :available, @inset_map.status
assert_nil @inset_map.rectified_at
end

end

0 comments on commit 4d48978

Please sign in to comment.