Skip to content

Commit

Permalink
rubocop-minitest: rubocop -a
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfb committed Jan 28, 2022
1 parent 37ed2ba commit 0e7dceb
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion test/controllers/boards_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def teardown

test 'should have max rank default' do
post :create, params: { board: FactoryBot.build(:board).attributes }
assert assigns(:board).rank == Board.count
assert_equal assigns(:board).rank, Board.count
assigns(:board).destroy
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/apis_workflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class ApisWorkflowTest < ActionDispatch::IntegrationTest
Rails.logger.debug '--APIS publication approved'

apis_final_publication = apis_publication.find_finalizer_publication
assert_equal apis_final_publication.status, 'finalizing', "Board user's publication is not for finalizing"
assert_equal('finalizing', apis_final_publication.status, "Board user's publication is not for finalizing")
Rails.logger.debug '---Finalizer has publication'

# call finalize on publication controller
Expand Down
2 changes: 1 addition & 1 deletion test/integration/community_workflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class CommunityWorkflowTest < ActionDispatch::IntegrationTest
# now finalizer should have it
meta_final_publication = meta_publication.find_finalizer_publication

assert_equal meta_final_publication.status, 'finalizing', "Board user's publication is not for finalizing"
assert_equal('finalizing', meta_final_publication.status, "Board user's publication is not for finalizing")
Rails.logger.debug '---Meta Finalizer has publication'

meta_final_identifier = nil
Expand Down
2 changes: 1 addition & 1 deletion test/integration/sosol_workflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class SosolWorkflowTest < ActionDispatch::IntegrationTest
Rails.logger.debug '--Meta publication approved'

meta_final_publication = meta_publication.find_finalizer_publication
assert_equal meta_final_publication.status, 'finalizing', "Board user's publication is not for finalizing"
assert_equal('finalizing', meta_final_publication.status, "Board user's publication is not for finalizing")
Rails.logger.debug '---Finalizer has publication'

# call finalize on publication controller
Expand Down
2 changes: 1 addition & 1 deletion test/unit/board_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BoardTest < ActiveSupport::TestCase
end

should 'have a repository' do
assert File.exist?(@path)
assert_path_exists(@path)
end

context 'upon destruction' do
Expand Down
2 changes: 1 addition & 1 deletion test/unit/cts_lib_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CTSLibTest < ActiveSupport::TestCase
if defined?(EXIST_HELPER_REPO)
type = CTS::CTSLib.versionTypeForUrn('perseus', 'urn:cts:greekLang:tlg0012.tlg001.perseus-grc1').to_s
Rails.logger.info("Type = #{type}")
assert type == 'edition'
assert_equal('edition', type)
end
end
end
Expand Down
21 changes: 11 additions & 10 deletions test/unit/oac_identifier_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ class OACIdentifierTest < ActiveSupport::TestCase
matches = @oac_identifier.matching_targets(
"#{Regexp.quote('urn:cts:greekLang:tlg0012.tlg001.perseus-grc1:1.1#')}?", @creator_uri
)
assert matches.size == 1
assert_equal(1, matches.size)
Rails.logger.info("Match = #{matches.inspect}")
assert matches[0]['target'] = @test_uri1
end

should 'retrieve the target by edition urn' do
assert @oac_identifier.matching_targets('urn:cts:greekLang:tlg0012.tlg001.perseus-grc1', @creator_uri).size == 1
assert_equal(1,
@oac_identifier.matching_targets('urn:cts:greekLang:tlg0012.tlg001.perseus-grc1', @creator_uri).size)
end

should 'have the target' do
Expand All @@ -72,7 +73,7 @@ class OACIdentifierTest < ActiveSupport::TestCase
end

should 'find the parent identifier' do
assert OACIdentifier.find_from_parent(@publication, @parent) == @oac_identifier
assert_equal OACIdentifier.find_from_parent(@publication, @parent), @oac_identifier
end

context 'with a new annotation ' do
Expand All @@ -88,17 +89,17 @@ class OACIdentifierTest < ActiveSupport::TestCase
should 'retrieve the annotation' do
annotation = @oac_identifier.get_annotation(@test_uri2)
assert_not annotation.nil?
assert @oac_identifier.get_targets(annotation).size == 1
assert @oac_identifier.get_targets(annotation)[0] == @test_tb2
assert @oac_identifier.get_body(annotation) == @test_tb1
assert @oac_identifier.get_title(annotation) == @test_title
assert @oac_identifier.get_creator(annotation) == @creator_uri
assert @oac_identifier.get_created(annotation) != ''
assert_equal(1, @oac_identifier.get_targets(annotation).size)
assert_equal @oac_identifier.get_targets(annotation)[0], @test_tb2
assert_equal @oac_identifier.get_body(annotation), @test_tb1
assert_equal @oac_identifier.get_title(annotation), @test_title
assert_equal @oac_identifier.get_creator(annotation), @creator_uri
assert_not_equal @oac_identifier.get_created(annotation), ''
end

should 'delete the annotation' do
@oac_identifier.delete_annotation(@test_uri2, 'test delete')
assert @oac_identifier.get_annotation(@test_uri2).nil?
assert_nil @oac_identifier.get_annotation(@test_uri2)
assert_not @oac_identifier.get_annotation(@test_uri1).nil?
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/unit/publication_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class PublicationTest < ActiveSupport::TestCase
end

should 'have a branch with its branch attribute' do
assert @user.repository.branches.include?(@publication.branch),
"#{@user.repository.branches.inspect} does not include #{@publication.branch}"
assert_includes @user.repository.branches, @publication.branch,
"#{@user.repository.branches.inspect} does not include #{@publication.branch}"
end

should 'delete its branch upon destruction' do
Expand Down Expand Up @@ -141,7 +141,7 @@ class PublicationTest < ActiveSupport::TestCase
end

should 'be a child of its parent' do
assert @publication.children.include?(@publication_copy)
assert_includes @publication.children, @publication_copy
end
end

Expand All @@ -167,7 +167,7 @@ class PublicationTest < ActiveSupport::TestCase
end

should 'have the branch' do
assert @user.repository.branches.include?(@publication.branch)
assert_includes @user.repository.branches, @publication.branch
end

should 'only have the original branches after deletion' do
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 @@ -16,7 +16,7 @@ class UserTest < ActiveSupport::TestCase
end

should 'have a repository' do
assert File.exist?(@path)
assert_path_exists(@path)
end

should 'delete its repository upon destruction' do
Expand Down
4 changes: 2 additions & 2 deletions test/unit/xml_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def setup
@element = REXML::Document.new(@xml).root.elements['//abc']
@formatter = REXML::Formatters::Default.new

assert @doc.instance_of?(REXML::Document), "could not create xml document from #{@xml}"
assert @element.instance_of?(REXML::Element), "could not create xml element from #{@xml}"
assert_instance_of REXML::Document, @doc, "could not create xml document from #{@xml}"
assert_instance_of REXML::Element, @element, "could not create xml element from #{@xml}"
end

def test_rexml_xpath_fully_qualified_and_simple
Expand Down

0 comments on commit 0e7dceb

Please sign in to comment.