Skip to content

Commit 469002c

Browse files
jkeenrichmolj
authored andcommitted
Fix test failures re: uninitialized constant Position
1 parent d93166d commit 469002c

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed
Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
RSpec.describe "stats" do
2-
let!(:pos1) { Position.create!(title: "a", employee_id: 1) }
3-
let!(:pos2) { Position.create!(title: "b", employee_id: 2) }
4-
let!(:pos3) { Position.create!(title: "c", employee_id: 2) }
5-
let!(:pos4) { Position.create!(title: "d", employee_id: 2) }
6-
let!(:pos5) { Position.create!(title: "e", employee_id: 3) }
7-
let!(:pos6) { Position.create!(title: "f", employee_id: 3) }
1+
if ENV["APPRAISAL_INITIALIZED"]
2+
RSpec.describe "stats" do
3+
let!(:pos1) { Position.create!(title: "a", employee_id: 1) }
4+
let!(:pos2) { Position.create!(title: "b", employee_id: 2) }
5+
let!(:pos3) { Position.create!(title: "c", employee_id: 2) }
6+
let!(:pos4) { Position.create!(title: "d", employee_id: 2) }
7+
let!(:pos5) { Position.create!(title: "e", employee_id: 3) }
8+
let!(:pos6) { Position.create!(title: "f", employee_id: 3) }
89

9-
after do
10-
Position.delete_all
11-
end
10+
after do
11+
Position.delete_all
12+
end
1213

13-
context "basic" do
14-
it "works" do
15-
proxy = PositionResource.all(stats: { total: "count" })
16-
expect(proxy.stats).to eq({
17-
total: {
18-
count: 6
19-
}
20-
})
14+
context "basic" do
15+
it "works" do
16+
proxy = PositionResource.all(stats: { total: "count" })
17+
expect(proxy.stats).to eq({
18+
total: {
19+
count: 6
20+
}
21+
})
22+
end
2123
end
22-
end
2324

24-
context "when grouping" do
25-
it "works" do
26-
proxy = PositionResource.all(stats: { total: "count", group_by: :employee_id })
27-
expect(proxy.stats).to eq({
28-
total: {
29-
count: {
30-
1 => 1,
31-
2 => 3,
32-
3 => 2
25+
context "when grouping" do
26+
it "works" do
27+
proxy = PositionResource.all(stats: { total: "count", group_by: :employee_id })
28+
expect(proxy.stats).to eq({
29+
total: {
30+
count: {
31+
1 => 1,
32+
2 => 3,
33+
3 => 2
34+
}
3335
}
34-
}
35-
})
36+
})
37+
end
3638
end
3739
end
38-
end
40+
end

0 commit comments

Comments
 (0)