Skip to content

Commit

Permalink
Removing rubocop cfg since #547 and renaming tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alaxalves committed Jun 1, 2019
1 parent 5d14d23 commit 0c69df6
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 25 deletions.
2 changes: 0 additions & 2 deletions .rubocop.yml

This file was deleted.

7 changes: 4 additions & 3 deletions test/unit/annotation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ def setup
@annotation = annotations(:lorem)
end

test 'should save annotation' do
test 'should save an annotation' do
map = maps(:saugus)
ann = map.annotations.new
ann.save!

assert_equal Annotation.count, @count + 1
end

test 'should return author' do
test 'should return an author' do
assert_equal 'quentin', @annotation.author
end

test 'geometry type' do
test 'should retrieve a geometry type' do
@annotation.annotation_type = 'Some random Geometry'
assert_equal @annotation.geometry_type, 'Point'

Expand Down
4 changes: 2 additions & 2 deletions test/unit/export_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'test_helper'

class ExportTest < ActiveSupport::TestCase
test "count methods" do
test 'should count methods' do
average = Export.all.map(&:cm_per_pixel).sum/Export.count
assert_not_nil Export.average_cm_per_pixel
assert_equal average, Export.average_cm_per_pixel
Expand All @@ -15,7 +15,7 @@ class ExportTest < ActiveSupport::TestCase
assert_equal 0, Export.average_cm_per_pixel
end

test "export running" do
test 'should export running' do
assert !Export.last.running?
end
end
2 changes: 1 addition & 1 deletion test/unit/exporter_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'test_helper'

class ExporterTest < ActiveSupport::TestCase
test "isolated exporter lib" do
test 'should export warpable using isolated exporter lib' do

# make a sample image
system('mkdir -p public/system/images/1/original')
Expand Down
21 changes: 14 additions & 7 deletions test/unit/map_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

class MapTest < ActiveSupport::TestCase

test "basics" do
test 'should not have empty default attributes' do
assert_not_nil Map.bbox(0,0,90,180)
assert_not_nil Map.authors
assert_not_nil Map.new_maps
end

test 'should create map' do
map = maps(:saugus)

assert_not_nil map.license_link
assert_not_nil map.author
assert_not_nil map.name
Expand All @@ -31,14 +35,14 @@ class MapTest < ActiveSupport::TestCase
assert_equal Map.count, Map.new_maps.size
end

test "export functions" do
test 'should export map related functions' do
map = maps(:saugus)
assert_not_nil map.average_scale

placed = map.warpables(&:placed?)

assert_not_nil map.placed_warpables
assert_equal placed, map.placed_warpables

assert_not_nil map.best_cm_per_pixel
assert_not_nil map.exporting?
assert_not_nil map.export
Expand Down Expand Up @@ -83,29 +87,32 @@ class MapTest < ActiveSupport::TestCase

end

test 'histograms' do
test 'should have histograms' do
map = maps(:saugus)
hist = map.images_histogram

assert_not_nil hist
assert_not_nil map.grouped_images_histogram(3)
assert_equal hist.count/3, map.grouped_images_histogram(3).count

end

test 'nearby maps' do
test 'should have nearby maps' do
map = maps(:nairobi)
near_maps = map.nearby_maps(5)

assert_not_nil near_maps
assert_includes near_maps, maps(:village)

saugus = maps(:saugus)
saugus.lat = 0
assert_empty saugus.nearby_maps(100)

assert_empty saugus.nearby_maps(100)
end

test "tag basics" do
test 'should create tag basics in map' do
map = Map.first

assert !map.has_tag('test')
assert map.add_tag('test', User.first)
assert map.has_tag('test')
Expand Down
4 changes: 0 additions & 4 deletions test/unit/node_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
require 'test_helper'

class NodeTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
4 changes: 3 additions & 1 deletion test/unit/tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

class TagTest < ActiveSupport::TestCase

test "basics" do
test 'should create sample tag' do
tag = Tag.first

assert_not_nil tag.name
assert_not_nil tag.maps

tag = Tag.find_by_name 'nice'

assert_not_nil tag.name
assert_not_nil tag.maps
assert_not_nil tag.maps.last.has_tag('nice')
Expand Down
2 changes: 1 addition & 1 deletion test/unit/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class UserTest < ActiveSupport::TestCase
)
end

test 'user simple query methods' do
test 'should edit and delete map' do
user = users(:quentin)
map = maps(:saugus)
assert user.owns?(map)
Expand Down
9 changes: 5 additions & 4 deletions test/unit/warpable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def setup
@warp = warpables(:one)
end

test 'basic warpable attributes' do
test 'should have basic warpable attributes' do
assert_equal "demo.png", @warp.image_file_name
assert_equal "image/png", @warp.image_content_type
assert_equal 392, @warp.height
Expand All @@ -18,7 +18,7 @@ def setup
assert_equal "1,2,3,4", @warp.nodes
end

test "json format methods" do
test 'should output json format methods' do
assert_not_nil @warp.as_json
assert_equal Hash, @warp.as_json.class
assert_equal @warp.attributes.size + 2, @warp.as_json.size
Expand All @@ -32,7 +32,7 @@ def setup
assert_equal 3, @warp.fup_error_json.size
end

test 'warpable small methods' do
test 'should execute warpable small methods' do
assert_not_nil @warp.placed?
assert @warp.placed?
assert_equal false, Warpable.new.placed?
Expand All @@ -53,12 +53,13 @@ def setup
assert_empty Warpable.histogram_cm_per_pixel
end

test "try export" do
test 'should try export warpables' do
# make a sample image
system('mkdir -p public/system/images/1/original')
system('cp test/fixtures/demo.png public/system/images/1/original/')
system('mkdir -p public/warps/saugus-landfill-incinerator')
system('touch public/warps/saugus-landfill-incinerator/folder')

assert File.exist?('public/warps/saugus-landfill-incinerator/folder')
assert_not_nil @warp.save_dimensions
assert_not_nil @warp.user_id
Expand Down

0 comments on commit 0c69df6

Please sign in to comment.