travis-ci
35 of 82 relevant lines covered (42.68%)
1.71 hits per line
1 |
module ActiveAdminImport |
4✔ |
2 |
class ImportResult |
4✔ |
3 |
attr_reader :failed, :total |
4✔ |
4 |
|
|
5 |
def initialize |
4✔ |
6 |
@failed = []
|
× |
7 |
@total = 0 |
× |
8 |
end
|
|
9 |
|
|
10 |
def add(result, qty) |
4✔ |
11 |
@failed += result.failed_instances
|
× |
12 |
@total+=qty
|
× |
13 |
end
|
|
14 |
|
|
15 |
def imported_qty |
4✔ |
16 |
total - failed.count |
× |
17 |
end
|
|
18 |
|
|
19 |
def has_imported? |
4✔ |
20 |
imported_qty > 0
|
× |
21 |
end
|
|
22 |
|
|
23 |
def has_failed? |
4✔ |
24 |
@failed.any?
|
× |
25 |
end
|
|
26 |
|
|
27 |
def empty? |
4✔ |
28 |
total == 0
|
× |
29 |
end
|
|
30 |
|
|
31 |
end
|
|
32 |
end
|