slather 0.0.235 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/.coveralls.yml +1 -0
- data/.gitignore +18 -0
- data/.travis.yml +20 -0
- data/README.md +59 -11
- data/bin/slather +11 -8
- data/docs/logo.jpg +0 -0
- data/lib/slather/coverage_file.rb +6 -5
- data/lib/slather/coverage_service/coveralls.rb +11 -2
- data/lib/slather/coverage_service/simple_output.rb +1 -0
- data/lib/slather/project.rb +43 -27
- data/lib/slather/version.rb +1 -1
- data/scripts/travis.sh +2 -0
- data/slather.gemspec +1 -0
- data/spec/fixtures/fixtures.xcodeproj/project.pbxproj +452 -0
- data/spec/fixtures/fixtures.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixtures.xcscheme +69 -0
- data/spec/fixtures/fixtures/Supporting Files/fixtures-Prefix.pch +9 -0
- data/spec/fixtures/fixtures/fixtures.h +16 -0
- data/spec/fixtures/fixtures/fixtures.m +23 -0
- data/spec/fixtures/fixtures/more_files/peekaview.h +13 -0
- data/spec/fixtures/fixtures/more_files/peekaview.m +31 -0
- data/spec/fixtures/fixturesTests/Supporting Files/en.lproj/InfoPlist.strings +2 -0
- data/spec/fixtures/fixturesTests/Supporting Files/fixturesTests-Info.plist +22 -0
- data/spec/fixtures/fixturesTests/fixturesTests.m +36 -0
- data/spec/fixtures/fixturesTests/peekaviewTests.m +34 -0
- data/spec/slather/coverage_file_spec.rb +106 -0
- data/spec/slather/coverage_service/coveralls_spec.rb +66 -0
- data/spec/slather/coverage_service/simple_output_spec.rb +26 -0
- data/spec/slather/fixtures.gcno +0 -0
- data/spec/slather/project_spec.rb +219 -0
- data/spec/spec_helper.rb +16 -0
- metadata +73 -18
@@ -0,0 +1,69 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Scheme
|
3
|
+
LastUpgradeVersion = "0600"
|
4
|
+
version = "1.3">
|
5
|
+
<BuildAction
|
6
|
+
parallelizeBuildables = "YES"
|
7
|
+
buildImplicitDependencies = "YES">
|
8
|
+
<BuildActionEntries>
|
9
|
+
<BuildActionEntry
|
10
|
+
buildForTesting = "YES"
|
11
|
+
buildForRunning = "YES"
|
12
|
+
buildForProfiling = "YES"
|
13
|
+
buildForArchiving = "YES"
|
14
|
+
buildForAnalyzing = "YES">
|
15
|
+
<BuildableReference
|
16
|
+
BuildableIdentifier = "primary"
|
17
|
+
BlueprintIdentifier = "8C9A202C195965F10013B6B3"
|
18
|
+
BuildableName = "libfixtures.a"
|
19
|
+
BlueprintName = "fixtures"
|
20
|
+
ReferencedContainer = "container:fixtures.xcodeproj">
|
21
|
+
</BuildableReference>
|
22
|
+
</BuildActionEntry>
|
23
|
+
</BuildActionEntries>
|
24
|
+
</BuildAction>
|
25
|
+
<TestAction
|
26
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
27
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
28
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
29
|
+
buildConfiguration = "Debug">
|
30
|
+
<Testables>
|
31
|
+
<TestableReference
|
32
|
+
skipped = "NO">
|
33
|
+
<BuildableReference
|
34
|
+
BuildableIdentifier = "primary"
|
35
|
+
BlueprintIdentifier = "8C9A203F195965F10013B6B3"
|
36
|
+
BuildableName = "fixturesTests.xctest"
|
37
|
+
BlueprintName = "fixturesTests"
|
38
|
+
ReferencedContainer = "container:fixtures.xcodeproj">
|
39
|
+
</BuildableReference>
|
40
|
+
</TestableReference>
|
41
|
+
</Testables>
|
42
|
+
</TestAction>
|
43
|
+
<LaunchAction
|
44
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
45
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
46
|
+
launchStyle = "0"
|
47
|
+
useCustomWorkingDirectory = "NO"
|
48
|
+
buildConfiguration = "Debug"
|
49
|
+
ignoresPersistentStateOnLaunch = "NO"
|
50
|
+
debugDocumentVersioning = "YES"
|
51
|
+
allowLocationSimulation = "YES">
|
52
|
+
<AdditionalOptions>
|
53
|
+
</AdditionalOptions>
|
54
|
+
</LaunchAction>
|
55
|
+
<ProfileAction
|
56
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
57
|
+
savedToolIdentifier = ""
|
58
|
+
useCustomWorkingDirectory = "NO"
|
59
|
+
buildConfiguration = "Release"
|
60
|
+
debugDocumentVersioning = "YES">
|
61
|
+
</ProfileAction>
|
62
|
+
<AnalyzeAction
|
63
|
+
buildConfiguration = "Debug">
|
64
|
+
</AnalyzeAction>
|
65
|
+
<ArchiveAction
|
66
|
+
buildConfiguration = "Release"
|
67
|
+
revealArchiveInOrganizer = "YES">
|
68
|
+
</ArchiveAction>
|
69
|
+
</Scheme>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//
|
2
|
+
// fixtures.h
|
3
|
+
// fixtures
|
4
|
+
//
|
5
|
+
// Created by Mark Larsen on 6/24/14.
|
6
|
+
// Copyright (c) 2014 marklarr. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
@interface fixtures : NSObject
|
12
|
+
|
13
|
+
- (void)testedMethod;
|
14
|
+
- (void)untestedMethod;
|
15
|
+
|
16
|
+
@end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
// fixtures.m
|
3
|
+
// fixtures
|
4
|
+
//
|
5
|
+
// Created by Mark Larsen on 6/24/14.
|
6
|
+
// Copyright (c) 2014 marklarr. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "fixtures.h"
|
10
|
+
|
11
|
+
@implementation fixtures
|
12
|
+
|
13
|
+
- (void)testedMethod
|
14
|
+
{
|
15
|
+
NSLog(@"tested");
|
16
|
+
}
|
17
|
+
|
18
|
+
- (void)untestedMethod
|
19
|
+
{
|
20
|
+
NSLog(@"untested");
|
21
|
+
}
|
22
|
+
|
23
|
+
@end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
//
|
2
|
+
// peekaview.m
|
3
|
+
// fixtures
|
4
|
+
//
|
5
|
+
// Created by Mark Larsen on 6/25/14.
|
6
|
+
// Copyright (c) 2014 marklarr. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "peekaview.h"
|
10
|
+
|
11
|
+
@implementation peekaview
|
12
|
+
|
13
|
+
- (id)initWithFrame:(CGRect)frame
|
14
|
+
{
|
15
|
+
self = [super initWithFrame:frame];
|
16
|
+
if (self) {
|
17
|
+
// Initialization code
|
18
|
+
}
|
19
|
+
return self;
|
20
|
+
}
|
21
|
+
|
22
|
+
/*
|
23
|
+
// Only override drawRect: if you perform custom drawing.
|
24
|
+
// An empty implementation adversely affects performance during animation.
|
25
|
+
- (void)drawRect:(CGRect)rect
|
26
|
+
{
|
27
|
+
// Drawing code
|
28
|
+
}
|
29
|
+
*/
|
30
|
+
|
31
|
+
@end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>en</string>
|
7
|
+
<key>CFBundleExecutable</key>
|
8
|
+
<string>${EXECUTABLE_NAME}</string>
|
9
|
+
<key>CFBundleIdentifier</key>
|
10
|
+
<string>marklarr.${PRODUCT_NAME:rfc1034identifier}</string>
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
12
|
+
<string>6.0</string>
|
13
|
+
<key>CFBundlePackageType</key>
|
14
|
+
<string>BNDL</string>
|
15
|
+
<key>CFBundleShortVersionString</key>
|
16
|
+
<string>1.0</string>
|
17
|
+
<key>CFBundleSignature</key>
|
18
|
+
<string>????</string>
|
19
|
+
<key>CFBundleVersion</key>
|
20
|
+
<string>1</string>
|
21
|
+
</dict>
|
22
|
+
</plist>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
//
|
2
|
+
// fixturesTests.m
|
3
|
+
// fixturesTests
|
4
|
+
//
|
5
|
+
// Created by Mark Larsen on 6/24/14.
|
6
|
+
// Copyright (c) 2014 marklarr. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <XCTest/XCTest.h>
|
10
|
+
#import "fixtures.h"
|
11
|
+
|
12
|
+
@interface fixturesTests : XCTestCase
|
13
|
+
|
14
|
+
@end
|
15
|
+
|
16
|
+
@implementation fixturesTests
|
17
|
+
|
18
|
+
- (void)setUp
|
19
|
+
{
|
20
|
+
[super setUp];
|
21
|
+
// Put setup code here. This method is called before the invocation of each test method in the class.
|
22
|
+
}
|
23
|
+
|
24
|
+
- (void)tearDown
|
25
|
+
{
|
26
|
+
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
27
|
+
[super tearDown];
|
28
|
+
}
|
29
|
+
|
30
|
+
- (void)testExample
|
31
|
+
{
|
32
|
+
fixtures *f = [[fixtures alloc] init];
|
33
|
+
[f testedMethod];
|
34
|
+
}
|
35
|
+
|
36
|
+
@end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
//
|
2
|
+
// peekaviewTests.m
|
3
|
+
// fixtures
|
4
|
+
//
|
5
|
+
// Created by Mark Larsen on 6/25/14.
|
6
|
+
// Copyright (c) 2014 marklarr. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <XCTest/XCTest.h>
|
10
|
+
|
11
|
+
@interface peekaviewTests : XCTestCase
|
12
|
+
|
13
|
+
@end
|
14
|
+
|
15
|
+
@implementation peekaviewTests
|
16
|
+
|
17
|
+
- (void)setUp
|
18
|
+
{
|
19
|
+
[super setUp];
|
20
|
+
// Put setup code here. This method is called before the invocation of each test method in the class.
|
21
|
+
}
|
22
|
+
|
23
|
+
- (void)tearDown
|
24
|
+
{
|
25
|
+
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
26
|
+
[super tearDown];
|
27
|
+
}
|
28
|
+
|
29
|
+
- (void)testExample
|
30
|
+
{
|
31
|
+
XCTAssert(YES, @"woot");
|
32
|
+
}
|
33
|
+
|
34
|
+
@end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
describe Slather::CoverageFile do
|
4
|
+
|
5
|
+
let(:fixtures_project) do
|
6
|
+
Slather::Project.open(FIXTURES_PROJECT_PATH)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:coverage_file) do
|
10
|
+
fixtures_project.send(:coverage_files).detect { |cf| cf.source_file_pathname.basename.to_s == "fixtures.m" }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#initialize" do
|
14
|
+
it "should convert the provided path string to a Pathname object, and set it as the gcno_file_pathname" do
|
15
|
+
expect(coverage_file.gcno_file_pathname.exist?).to be_truthy
|
16
|
+
expect(coverage_file.gcno_file_pathname.basename.to_s).to eq("fixtures.gcno")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#source_file_pathname" do
|
21
|
+
it "should return the path to the coverage files's source implementation file" do
|
22
|
+
expect(coverage_file.source_file_pathname).to eq(fixtures_project["fixtures/fixtures.m"].real_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return nil if it couldn't find the coverage files's source implementation file in the project" do
|
26
|
+
whoami_file = Slather::CoverageFile.new(fixtures_project, "/some/path/whoami.gcno")
|
27
|
+
expect(whoami_file.source_file_pathname).to be_nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#source_file" do
|
32
|
+
it "should return a file object for the source_file_pathname" do
|
33
|
+
file = coverage_file.source_file
|
34
|
+
expect(file.kind_of?(File)).to be_truthy
|
35
|
+
expect(Pathname(file.path)).to eq(coverage_file.source_file_pathname)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#source_data" do
|
40
|
+
it "should return the contents of the source_file" do
|
41
|
+
expected = <<-OBJC
|
42
|
+
//
|
43
|
+
// fixtures.m
|
44
|
+
// fixtures
|
45
|
+
//
|
46
|
+
// Created by Mark Larsen on 6/24/14.
|
47
|
+
// Copyright (c) 2014 marklarr. All rights reserved.
|
48
|
+
//
|
49
|
+
|
50
|
+
#import "fixtures.h"
|
51
|
+
|
52
|
+
@implementation fixtures
|
53
|
+
|
54
|
+
- (void)testedMethod
|
55
|
+
{
|
56
|
+
NSLog(@"tested");
|
57
|
+
}
|
58
|
+
|
59
|
+
- (void)untestedMethod
|
60
|
+
{
|
61
|
+
NSLog(@"untested");
|
62
|
+
}
|
63
|
+
|
64
|
+
@end
|
65
|
+
OBJC
|
66
|
+
expect(coverage_file.source_data).to eq(expected)
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "source_file_pathname_relative_to_repo_root" do
|
70
|
+
it "should return a pathname to the source_file, relative to the root of the repo" do
|
71
|
+
expect(coverage_file.source_file_pathname_relative_to_repo_root).to eq(Pathname("spec/fixtures/fixtures/fixtures.m"))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#coverage_for_line" do
|
76
|
+
it "should return nil if the line is not relevant to coverage" do
|
77
|
+
expect(coverage_file.coverage_for_line(" -: 75: }")).to be_nil
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return the number of times the line was executed if the line is relevant to coverage" do
|
81
|
+
expect(coverage_file.coverage_for_line(" 1: 75: }")).to eq(1)
|
82
|
+
expect(coverage_file.coverage_for_line(" 15: 75: }")).to eq(15)
|
83
|
+
expect(coverage_file.coverage_for_line(" ####: 75: }")).to eq(0)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "#ignored" do
|
88
|
+
it "should return true if the source_file_pathname globs against anything in the project.ignore_list" do
|
89
|
+
coverage_file.project.ignore_list = ["*spec*", "*test*"]
|
90
|
+
expect(coverage_file.ignored?).to be_truthy
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should return false if the source_file_pathname does not glob against anything in the project.ignore_list" do
|
94
|
+
coverage_file.project.ignore_list = ["*test*", "*XCTest*"]
|
95
|
+
expect(coverage_file.ignored?).to be_falsy
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "gcov_data" do
|
100
|
+
it "should process the gcno file with gcov and return the contents of the file" do
|
101
|
+
expect(coverage_file.gcov_data.include?("1: 15: NSLog(@\"tested\");")).to be_truthy
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
|
2
|
+
|
3
|
+
describe Slather::CoverageService::Coveralls do
|
4
|
+
|
5
|
+
let(:fixtures_project) do
|
6
|
+
proj = Slather::Project.open(FIXTURES_PROJECT_PATH)
|
7
|
+
proj.extend(Slather::CoverageService::Coveralls)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#coverage_file_class" do
|
11
|
+
it "should return CoverallsCoverageFile" do
|
12
|
+
expect(fixtures_project.send(:coverage_file_class)).to eq(Slather::CoverallsCoverageFile)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#travis_job_id" do
|
17
|
+
it "should return the TRAVIS_JOB_ID environment variable" do
|
18
|
+
ENV['TRAVIS_JOB_ID'] = "9182"
|
19
|
+
expect(fixtures_project.send(:travis_job_id)).to eq("9182")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#coveralls_coverage_data' do
|
24
|
+
|
25
|
+
context "coverage_service is :travis_ci" do
|
26
|
+
before(:each) { fixtures_project.ci_service = :travis_ci }
|
27
|
+
|
28
|
+
it "should return valid json for coveralls coverage data" do
|
29
|
+
fixtures_project.stub(:travis_job_id).and_return("9182")
|
30
|
+
expect(fixtures_project.send(:coveralls_coverage_data)).to eq("{\"service_job_id\":\"9182\",\"service_name\":\"travis-ci\",\"source_files\":[{\"name\":\"spec/fixtures/fixtures/fixtures.m\",\"source\":\"//\\n// fixtures.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/24/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import \\\"fixtures.h\\\"\\n\\n@implementation fixtures\\n\\n- (void)testedMethod\\n{\\n NSLog(@\\\"tested\\\");\\n}\\n\\n- (void)untestedMethod\\n{\\n NSLog(@\\\"untested\\\");\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,1,null,null,null,0,0,null,null]},{\"name\":\"spec/fixtures/fixtures/more_files/peekaview.m\",\"source\":\"//\\n// peekaview.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/25/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import \\\"peekaview.h\\\"\\n\\n@implementation peekaview\\n\\n- (id)initWithFrame:(CGRect)frame\\n{\\n self = [super initWithFrame:frame];\\n if (self) {\\n // Initialization code\\n }\\n return self;\\n}\\n\\n/*\\n// Only override drawRect: if you perform custom drawing.\\n// An empty implementation adversely affects performance during animation.\\n- (void)drawRect:(CGRect)rect\\n{\\n // Drawing code\\n}\\n*/\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,0,null,0,0,null,0,0,0,null,null,null,null,null,null,null,null,null,null,null]},{\"name\":\"spec/fixtures/fixturesTests/fixturesTests.m\",\"source\":\"//\\n// fixturesTests.m\\n// fixturesTests\\n//\\n// Created by Mark Larsen on 6/24/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import <XCTest/XCTest.h>\\n#import \\\"fixtures.h\\\"\\n\\n@interface fixturesTests : XCTestCase\\n\\n@end\\n\\n@implementation fixturesTests\\n\\n- (void)setUp\\n{\\n [super setUp];\\n // Put setup code here. This method is called before the invocation of each test method in the class.\\n}\\n\\n- (void)tearDown\\n{\\n // Put teardown code here. This method is called after the invocation of each test method in the class.\\n [super tearDown];\\n}\\n\\n- (void)testExample\\n{\\n fixtures *f = [[fixtures alloc] init];\\n [f testedMethod];\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,1,null,null,null,null,1,1,null,null,null,1,1,1,null,null]},{\"name\":\"spec/fixtures/fixturesTests/peekaviewTests.m\",\"source\":\"//\\n// peekaviewTests.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/25/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import <XCTest/XCTest.h>\\n\\n@interface peekaviewTests : XCTestCase\\n\\n@end\\n\\n@implementation peekaviewTests\\n\\n- (void)setUp\\n{\\n [super setUp];\\n // Put setup code here. This method is called before the invocation of each test method in the class.\\n}\\n\\n- (void)tearDown\\n{\\n // Put teardown code here. This method is called after the invocation of each test method in the class.\\n [super tearDown];\\n}\\n\\n- (void)testExample\\n{\\n XCTAssert(YES, @\\\"woot\\\");\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,1,null,null,null,null,1,1,null,null,null,2,1,null,null]}]}")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should raise an error if there is no TRAVIS_JOB_ID" do
|
34
|
+
fixtures_project.stub(:travis_job_id).and_return(nil)
|
35
|
+
expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should raise an error if it does not recognize the ci_service" do
|
40
|
+
fixtures_project.ci_service = :jenkins_ci
|
41
|
+
expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#post' do
|
46
|
+
it "should save the coveralls_coverage_data to a file and post it to coveralls" do
|
47
|
+
fixtures_project.stub(:travis_job_id).and_return("9182")
|
48
|
+
expect(fixtures_project).to receive(:`) do |cmd|
|
49
|
+
expect(cmd).to eq("curl -s --form json_file=@coveralls_json_file https://coveralls.io/api/v1/jobs")
|
50
|
+
expect(File.open('coveralls_json_file', 'r').read).to eq("{\"service_job_id\":\"9182\",\"service_name\":\"travis-ci\",\"source_files\":[{\"name\":\"spec/fixtures/fixtures/fixtures.m\",\"source\":\"//\\n// fixtures.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/24/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import \\\"fixtures.h\\\"\\n\\n@implementation fixtures\\n\\n- (void)testedMethod\\n{\\n NSLog(@\\\"tested\\\");\\n}\\n\\n- (void)untestedMethod\\n{\\n NSLog(@\\\"untested\\\");\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,1,null,null,null,0,0,null,null]},{\"name\":\"spec/fixtures/fixtures/more_files/peekaview.m\",\"source\":\"//\\n// peekaview.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/25/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import \\\"peekaview.h\\\"\\n\\n@implementation peekaview\\n\\n- (id)initWithFrame:(CGRect)frame\\n{\\n self = [super initWithFrame:frame];\\n if (self) {\\n // Initialization code\\n }\\n return self;\\n}\\n\\n/*\\n// Only override drawRect: if you perform custom drawing.\\n// An empty implementation adversely affects performance during animation.\\n- (void)drawRect:(CGRect)rect\\n{\\n // Drawing code\\n}\\n*/\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,0,null,0,0,null,0,0,0,null,null,null,null,null,null,null,null,null,null,null]},{\"name\":\"spec/fixtures/fixturesTests/fixturesTests.m\",\"source\":\"//\\n// fixturesTests.m\\n// fixturesTests\\n//\\n// Created by Mark Larsen on 6/24/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import <XCTest/XCTest.h>\\n#import \\\"fixtures.h\\\"\\n\\n@interface fixturesTests : XCTestCase\\n\\n@end\\n\\n@implementation fixturesTests\\n\\n- (void)setUp\\n{\\n [super setUp];\\n // Put setup code here. This method is called before the invocation of each test method in the class.\\n}\\n\\n- (void)tearDown\\n{\\n // Put teardown code here. This method is called after the invocation of each test method in the class.\\n [super tearDown];\\n}\\n\\n- (void)testExample\\n{\\n fixtures *f = [[fixtures alloc] init];\\n [f testedMethod];\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,1,null,null,null,null,1,1,null,null,null,1,1,1,null,null]},{\"name\":\"spec/fixtures/fixturesTests/peekaviewTests.m\",\"source\":\"//\\n// peekaviewTests.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/25/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import <XCTest/XCTest.h>\\n\\n@interface peekaviewTests : XCTestCase\\n\\n@end\\n\\n@implementation peekaviewTests\\n\\n- (void)setUp\\n{\\n [super setUp];\\n // Put setup code here. This method is called before the invocation of each test method in the class.\\n}\\n\\n- (void)tearDown\\n{\\n // Put teardown code here. This method is called after the invocation of each test method in the class.\\n [super tearDown];\\n}\\n\\n- (void)testExample\\n{\\n XCTAssert(YES, @\\\"woot\\\");\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,1,null,null,null,null,1,1,null,null,null,2,1,null,null]}]}")
|
51
|
+
end.once
|
52
|
+
fixtures_project.post
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should always remove the coveralls_json_file after it's done" do
|
56
|
+
fixtures_project.stub(:`)
|
57
|
+
|
58
|
+
fixtures_project.stub(:travis_job_id).and_return("9182")
|
59
|
+
fixtures_project.post
|
60
|
+
expect(File.exist?("coveralls_json_file")).to be_falsy
|
61
|
+
fixtures_project.stub(:travis_job_id).and_return(nil)
|
62
|
+
expect { fixtures_project.post }.to raise_error
|
63
|
+
expect(File.exist?("coveralls_json_file")).to be_falsy
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|