Skip to content

Commit

Permalink
Remove unused junit methods
Browse files Browse the repository at this point in the history
  • Loading branch information
robolson committed Oct 20, 2015
1 parent ac29a61 commit 1066338
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 56 deletions.
5 changes: 0 additions & 5 deletions app/models/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,6 @@ def is_running?
IN_PROGRESS_STATES.include?(self.state)
end

def junit_failures
# TODO: fix n+1
build_parts.map(&:last_junit_failures).flatten
end

private

def status_png(r, g, b)
Expand Down
1 change: 0 additions & 1 deletion app/models/build_artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ class BuildArtifact < ActiveRecord::Base
validates_presence_of :log_file

scope :stdout_log, -> { where(:log_file => ['stdout.log.gz', 'stdout.log']) }
scope :junit_log, -> { where(:log_file => 'rspec.xml.log.gz') }
scope :error_txt, -> { where(:log_file => 'error.txt') }
end
15 changes: 0 additions & 15 deletions app/models/build_part.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,4 @@ def should_reattempt?
false
end
end

def last_junit_artifact
artifacts = last_completed_attempt.try(:build_artifacts)
artifacts ? artifacts.junit_log.first : nil
end

def last_junit_failures
junit_artifact = last_junit_artifact
if junit_artifact
Zlib::GzipReader.open(junit_artifact.log_file.path) do |gz|
xml = Nokogiri::XML.parse(gz)
xml.xpath('//testcase[failure]')
end
end
end
end
14 changes: 0 additions & 14 deletions spec/fixtures/rspec.xml.log

This file was deleted.

12 changes: 6 additions & 6 deletions spec/models/build_artifact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
expect(ba).to be_valid
end

describe "junit_log scope" do
let!(:artifact) { FactoryGirl.create :build_artifact }
let!(:junit_artifact) { FactoryGirl.create :build_artifact, :log_file => File.open(FIXTURE_PATH + 'rspec.xml.log.gz') }
describe "stdout_log scope" do
let!(:artifact) { FactoryGirl.create :build_artifact }
let!(:stdout_artifact) { FactoryGirl.create :build_artifact, :log_file => File.open(FIXTURE_PATH + 'stdout.log.gz') }

subject { BuildArtifact.junit_log }
subject { BuildArtifact.stdout_log }

it "should return artifacts that match rspec.xml.log" do
it "should return artifacts that match stdout.log" do
should_not include(artifact)
should include(junit_artifact)
should include(stdout_artifact)
end
end
end
15 changes: 0 additions & 15 deletions spec/models/build_part_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,6 @@
end
end

describe "#last_junit_artifact" do
let(:artifact) { FactoryGirl.create(:build_artifact, :log_file => File.open(FIXTURE_PATH + "rspec.xml.log.gz")) }
let(:part) { artifact.build_attempt.build_part }

subject { part.last_junit_artifact }

it { should == artifact }

describe "#last_junit_failures" do
subject { part.last_junit_failures }

it { should have(1).testcase }
end
end

describe "#should_reattempt?" do
let(:build_part) { FactoryGirl.create(:build_part, retry_count: 1, build_instance: build) }

Expand Down

0 comments on commit 1066338

Please sign in to comment.