slather 0.0.3 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +0 -18
- data/README.md +10 -49
- data/bin/slather +8 -76
- data/lib/slather.rb +0 -5
- data/lib/slather/coverage_file.rb +5 -12
- data/lib/slather/coveralls_coverage_file.rb +1 -1
- data/lib/slather/project.rb +30 -75
- data/lib/slather/version.rb +1 -1
- metadata +3 -39
- data/lib/slather/coverage_service/coveralls.rb +0 -52
- data/lib/slather/coverage_service/simple_output.rb +0 -32
- data/spec/fixtures/fixtures.xcodeproj/project.pbxproj +0 -452
- data/spec/fixtures/fixtures.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/spec/fixtures/fixtures/Supporting Files/fixtures-Prefix.pch +0 -9
- data/spec/fixtures/fixtures/fixtures.h +0 -16
- data/spec/fixtures/fixtures/fixtures.m +0 -23
- data/spec/fixtures/fixtures/more_files/peekaview.h +0 -13
- data/spec/fixtures/fixtures/more_files/peekaview.m +0 -31
- data/spec/fixtures/fixturesTests/Supporting Files/en.lproj/InfoPlist.strings +0 -2
- data/spec/fixtures/fixturesTests/Supporting Files/fixturesTests-Info.plist +0 -22
- data/spec/fixtures/fixturesTests/fixturesTests.m +0 -36
- data/spec/fixtures/fixturesTests/peekaviewTests.m +0 -34
- data/spec/slather/coverage_file_spec.rb +0 -136
- data/spec/slather/coverage_service/coveralls_spec.rb +0 -66
- data/spec/slather/coverage_service/simple_output_spec.rb +0 -26
- data/spec/slather/fixtures.gcno +0 -0
- data/spec/slather/project_spec.rb +0 -219
- data/spec/spec_helper.rb +0 -10
@@ -1,219 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
-
|
3
|
-
describe Slather::Project do
|
4
|
-
|
5
|
-
let(:fixtures_project) do
|
6
|
-
Slather::Project.any_instance.stub(:configure_from_yml)
|
7
|
-
Slather::Project.open(FIXTURES_PROJECT_PATH)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "::open" do
|
11
|
-
it "should return a project instance that has been configured from yml" do
|
12
|
-
expect_any_instance_of(Slather::Project).to receive(:configure_from_yml)
|
13
|
-
expect(fixtures_project).not_to be_nil
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "#derived_data_dir" do
|
18
|
-
it "should return the system's derived data directory" do
|
19
|
-
expect(fixtures_project.send(:derived_data_dir)).to eq(File.expand_path('~') + "/Library/Developer/Xcode/DerivedData/")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#build_directory" do
|
24
|
-
it "should return the build_directory property, if it has been explicitly set" do
|
25
|
-
build_directory_mock = double(String)
|
26
|
-
fixtures_project.build_directory = build_directory_mock
|
27
|
-
expect(fixtures_project.build_directory).to eq(build_directory_mock)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should return the derived_data_dir if no build_directory has been set" do
|
31
|
-
derived_data_dir_mock = double(String)
|
32
|
-
fixtures_project.stub(:derived_data_dir).and_return(derived_data_dir_mock)
|
33
|
-
expect(fixtures_project.build_directory).to eq(derived_data_dir_mock)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "::yml" do
|
38
|
-
before(:each) { Slather::Project.instance_variable_set("@yml", nil) }
|
39
|
-
|
40
|
-
context ".slather.yml file exists" do
|
41
|
-
before(:all) { File.open(".slather.yml", "w") { |f| f.write("two: 2") } }
|
42
|
-
after(:all) { File.delete(".slather.yml") }
|
43
|
-
|
44
|
-
it "should load and return .slather.yml, if it exists" do
|
45
|
-
expect(Slather::Project.yml).to eq({"two" => 2})
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context ".slather.yml file doesn't exist" do
|
50
|
-
it "should return an empy hash" do
|
51
|
-
expect(Slather::Project.yml).to eq({})
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "#coverage_files" do
|
57
|
-
class SpecCoverageFile < Slather::CoverageFile
|
58
|
-
end
|
59
|
-
|
60
|
-
before(:each) do
|
61
|
-
Dir.stub(:[]).and_call_original
|
62
|
-
Dir.stub(:[]).with("#{fixtures_project.build_directory}/**/*.gcno").and_return(["/some/path/fixtures.gcno",
|
63
|
-
"/some/path/peekaview.gcno",
|
64
|
-
"/some/path/fixturesTests.gcno",
|
65
|
-
"/some/path/peekaviewTests.gcno",
|
66
|
-
"/some/path/NotInProject.gcno",
|
67
|
-
"/some/path/NSRange.gcno"])
|
68
|
-
fixtures_project.stub(:coverage_file_class).and_return(SpecCoverageFile)
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should return coverage file objects of type coverage_file_class for unignored project files" do
|
72
|
-
fixtures_project.ignore_list = ["*fixturesTests*"]
|
73
|
-
coverage_files = fixtures_project.send(:coverage_files)
|
74
|
-
coverage_files.each { |cf| expect(cf.kind_of?(SpecCoverageFile)).to be_truthy }
|
75
|
-
expect(coverage_files.map { |cf| cf.source_file_pathname.basename.to_s }).to eq(["fixtures.m", "peekaview.m"])
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should raise an exception if no unignored project coverage file files were found" do
|
79
|
-
fixtures_project.ignore_list = ["*fixturesTests*", "*fixtures*"]
|
80
|
-
expect {fixtures_project.send(:coverage_files)}.to raise_error(StandardError)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "#configure_from_yml" do
|
85
|
-
it "should configure all properties from the yml" do
|
86
|
-
unstubbed_project = Slather::Project.open(FIXTURES_PROJECT_PATH)
|
87
|
-
expect(unstubbed_project).to receive(:configure_build_directory_from_yml)
|
88
|
-
expect(unstubbed_project).to receive(:configure_ignore_list_from_yml)
|
89
|
-
expect(unstubbed_project).to receive(:configure_ci_service_from_yml)
|
90
|
-
expect(unstubbed_project).to receive(:configure_coverage_service_from_yml)
|
91
|
-
unstubbed_project.configure_from_yml
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "#configure_ignore_list_from_yml" do
|
96
|
-
it "should set the ignore_list if it has been provided in the yml and has not already been set" do
|
97
|
-
Slather::Project.stub(:yml).and_return({"ignore" => ["test", "ing"] })
|
98
|
-
fixtures_project.configure_ignore_list_from_yml
|
99
|
-
expect(fixtures_project.ignore_list).to eq(["test", "ing"])
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should force the ignore_list into an array" do
|
103
|
-
Slather::Project.stub(:yml).and_return({"ignore" => "test" })
|
104
|
-
fixtures_project.configure_ignore_list_from_yml
|
105
|
-
expect(fixtures_project.ignore_list).to eq(["test"])
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should not set the ignore_list if it has already been set" do
|
109
|
-
Slather::Project.stub(:yml).and_return({"ignore" => ["test", "ing"] })
|
110
|
-
fixtures_project.ignore_list = ["already", "set"]
|
111
|
-
fixtures_project.configure_ignore_list_from_yml
|
112
|
-
expect(fixtures_project.ignore_list).to eq(["already", "set"])
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should default the ignore_list to an empty array if nothing is provided in the yml" do
|
116
|
-
Slather::Project.stub(:yml).and_return({})
|
117
|
-
fixtures_project.configure_ignore_list_from_yml
|
118
|
-
expect(fixtures_project.ignore_list).to eq([])
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe "#configure_build_directory_from_yml" do
|
123
|
-
it "should set the build_directory if it has been provided in the yml and has not already been set" do
|
124
|
-
Slather::Project.stub(:yml).and_return({"build_directory" => "/some/path"})
|
125
|
-
fixtures_project.configure_build_directory_from_yml
|
126
|
-
expect(fixtures_project.build_directory).to eq("/some/path")
|
127
|
-
end
|
128
|
-
|
129
|
-
it "should not set the build_directory if it has already been set" do
|
130
|
-
Slather::Project.stub(:yml).and_return({"build_directory" => "/some/path"})
|
131
|
-
fixtures_project.build_directory = "/already/set"
|
132
|
-
fixtures_project.configure_build_directory_from_yml
|
133
|
-
expect(fixtures_project.build_directory).to eq("/already/set")
|
134
|
-
end
|
135
|
-
|
136
|
-
it "should default the build_directory to derived data if nothing is provided in the yml" do
|
137
|
-
Slather::Project.stub(:yml).and_return({})
|
138
|
-
fixtures_project.configure_build_directory_from_yml
|
139
|
-
expect(fixtures_project.build_directory).to eq(fixtures_project.send(:derived_data_dir))
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe "#configure_ci_service_from_yml" do
|
144
|
-
it "should set the ci_service if it has been provided in the yml and has not already been set" do
|
145
|
-
Slather::Project.stub(:yml).and_return({"ci_service" => "some_service"})
|
146
|
-
fixtures_project.configure_ci_service_from_yml
|
147
|
-
expect(fixtures_project.ci_service).to eq(:some_service)
|
148
|
-
end
|
149
|
-
|
150
|
-
it "should not set the ci_service if it has already been set" do
|
151
|
-
Slather::Project.stub(:yml).and_return({"ci_service" => "some service"})
|
152
|
-
fixtures_project.ci_service = "already_set"
|
153
|
-
fixtures_project.configure_ci_service_from_yml
|
154
|
-
expect(fixtures_project.ci_service).to eq(:already_set)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "should default the ci_service to :travis_ci if nothing is provided in the yml" do
|
158
|
-
Slather::Project.stub(:yml).and_return({})
|
159
|
-
fixtures_project.configure_ci_service_from_yml
|
160
|
-
expect(fixtures_project.ci_service).to eq(:travis_ci)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
describe "#ci_service=" do
|
165
|
-
it "should set the ci_service as a symbol" do
|
166
|
-
fixtures_project.ci_service = "foobar"
|
167
|
-
expect(fixtures_project.ci_service).to eq(:foobar)
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
describe "#configure_coverage_service_from_yml" do
|
172
|
-
it "should set the coverage_service if it has been provided by the yml" do
|
173
|
-
Slather::Project.stub(:yml).and_return({"coverage_service" => "some_service"})
|
174
|
-
expect(fixtures_project).to receive(:coverage_service=).with("some_service")
|
175
|
-
fixtures_project.configure_coverage_service_from_yml
|
176
|
-
end
|
177
|
-
|
178
|
-
it "should default the coverage_service to :terminal if nothing is provided in the yml" do
|
179
|
-
Slather::Project.stub(:yml).and_return({})
|
180
|
-
expect(fixtures_project).to receive(:coverage_service=).with(:terminal)
|
181
|
-
fixtures_project.configure_coverage_service_from_yml
|
182
|
-
end
|
183
|
-
|
184
|
-
it "should not set the coverage_service if it has already been set" do
|
185
|
-
Slather::Project.stub(:yml).and_return({"coverage_service" => "some_service" })
|
186
|
-
fixtures_project.stub(:coverage_service).and_return("already set")
|
187
|
-
expect(fixtures_project).to_not receive(:coverage_service=)
|
188
|
-
fixtures_project.configure_coverage_service_from_yml
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
describe "#coverage_service=" do
|
193
|
-
it "should extend Slather::CoverageService::Coveralls and set coverage_service = :coveralls if given coveralls" do
|
194
|
-
expect(fixtures_project).to receive(:extend).with(Slather::CoverageService::Coveralls)
|
195
|
-
fixtures_project.coverage_service = "coveralls"
|
196
|
-
expect(fixtures_project.coverage_service).to eq(:coveralls)
|
197
|
-
end
|
198
|
-
|
199
|
-
it "should extend Slather::CoverageService::SimpleOutput and set coverage_service = :terminal if given terminal" do
|
200
|
-
expect(fixtures_project).to receive(:extend).with(Slather::CoverageService::SimpleOutput)
|
201
|
-
fixtures_project.coverage_service = "terminal"
|
202
|
-
expect(fixtures_project.coverage_service).to eq(:terminal)
|
203
|
-
end
|
204
|
-
|
205
|
-
it "should raise an exception if it does not recognize the coverage service" do
|
206
|
-
expect { fixtures_project.coverage_service = "xcode bots, lol" }.to raise_error(StandardError)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
describe "#setup_for_coverage" do
|
211
|
-
it "should enable the correct flags to generate test coverage on all of the build_configurations build settings" do
|
212
|
-
fixtures_project.setup_for_coverage
|
213
|
-
fixtures_project.build_configurations.each do |build_configuration|
|
214
|
-
expect(build_configuration.build_settings["GCC_INSTRUMENT_PROGRAM_FLOW_ARCS"]).to eq("YES")
|
215
|
-
expect(build_configuration.build_settings["GCC_GENERATE_TEST_COVERAGE_FILES"]).to eq("YES")
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|