|
10 | 10 | end |
11 | 11 |
|
12 | 12 | before do |
13 | | - allow(file).to receive(:mesh).and_return(mesh) |
| 13 | + allow(described_class).to receive(:load_mesh).with(file).and_return(mesh) |
14 | 14 | allow(ModelFile).to receive(:find).and_call_original |
15 | 15 | allow(ModelFile).to receive(:find).with(file.id).and_return(file) |
16 | 16 | allow(SiteSettings).to receive(:analyse_manifold).and_return(true) |
17 | 17 | end |
18 | 18 |
|
19 | 19 | it "does not create Problems for a good mesh" do |
20 | | - allow(file).to receive(:mesh).and_return(mesh) |
| 20 | + allow(described_class).to receive(:load_mesh).with(file).and_return(mesh) |
21 | 21 | expect { described_class.perform_now(file.id) }.not_to change(Problem, :count) |
22 | 22 | end |
23 | 23 |
|
24 | 24 | it "creates a Problem for a non-manifold mesh" do # rubocop:todo RSpec/MultipleExpectations |
25 | 25 | allow(mesh).to receive(:manifold?).and_return(false) |
26 | | - allow(file).to receive(:mesh).and_return(mesh) |
| 26 | + allow(described_class).to receive(:load_mesh).with(file).and_return(mesh) |
27 | 27 | expect { described_class.perform_now(file.id) }.to change(Problem, :count).from(0).to(1) |
28 | 28 | expect(Problem.first.category).to eq "non_manifold" |
29 | 29 | end |
30 | 30 |
|
31 | 31 | it "removes a manifold problem if the mesh is OK" do |
32 | | - allow(file).to receive(:mesh).and_return(mesh) |
| 32 | + allow(described_class).to receive(:load_mesh).with(file).and_return(mesh) |
33 | 33 | create(:problem, problematic: file, category: :non_manifold) |
34 | 34 | expect { described_class.perform_now(file.id) }.to change(Problem, :count).from(1).to(0) |
35 | 35 | end |
36 | 36 |
|
37 | 37 | it "creates a Problem for an inside-out mesh" do # rubocop:todo RSpec/MultipleExpectations |
38 | 38 | pending "not currently working reliably" |
39 | 39 | allow(mesh).to receive(:solid?).and_return(false) |
40 | | - allow(file).to receive(:mesh).and_return(mesh) |
| 40 | + allow(described_class).to receive(:load_mesh).with(file).and_return(mesh) |
41 | 41 | expect { described_class.perform_now(file.id) }.to change(Problem, :count).from(0).to(1) |
42 | 42 | expect(Problem.first.category).to eq "inside_out" |
43 | 43 | end |
44 | 44 |
|
45 | 45 | it "removes an inside-out problem if the mesh is OK" do |
46 | 46 | pending "not currently working reliably" |
47 | | - allow(file).to receive(:mesh).and_return(mesh) |
| 47 | + allow(described_class).to receive(:load_mesh).with(file).and_return(mesh) |
48 | 48 | create(:problem, problematic: file, category: :inside_out) |
49 | 49 | expect { described_class.perform_now(file.id) }.to change(Problem, :count).from(1).to(0) |
50 | 50 | end |
|
0 commit comments