|
24 | 24 | end |
25 | 25 |
|
26 | 26 | describe "scopes" do |
| 27 | + let(:user) { create(:user) } |
27 | 28 | let!(:completed_trasncript) { create :transcript, percent_completed: 100 } |
28 | 29 | let!(:reviewing_trasncript) { create :transcript, percent_reviewing: 37 } |
29 | 30 | let!(:not_completed_trasncript) { create :transcript, percent_edited: 37 } |
|
39 | 40 | it "gets pending" do |
40 | 41 | expect(described_class.pending.to_a).to eq([not_completed_trasncript]) |
41 | 42 | end |
| 43 | + |
| 44 | + it 'gets edited' do |
| 45 | + expect(described_class.getEdited).to eq([]) |
| 46 | + end |
| 47 | + |
| 48 | + it 'gets user edited' do |
| 49 | + expect(described_class.getByUserEdited(user.id)).to eq([]) |
| 50 | + end |
| 51 | + end |
| 52 | + |
| 53 | + it "returns .seconds_per_line" do |
| 54 | + expect(described_class.seconds_per_line).to eq(5) |
42 | 55 | end |
43 | 56 |
|
44 | 57 | describe "validate uid does not change after create" do |
45 | 58 | let(:vendor) { Vendor.create!(uid: "voice_base", name: "VoiceBase") } |
46 | 59 | let(:transcript) do |
47 | | - Transcript.new( |
| 60 | + described_class.new( |
48 | 61 | uid: "transcript_test", |
49 | 62 | vendor_id: vendor.id, |
50 | 63 | ) |
|
64 | 77 | end |
65 | 78 | end |
66 | 79 |
|
| 80 | + describe "#transcription_conventions" do |
| 81 | + let(:transcript) { create(:transcript) } |
| 82 | + |
| 83 | + it "returns conventions" do |
| 84 | + expect(transcript.transcription_conventions.size).to eq(8) |
| 85 | + end |
| 86 | + end |
| 87 | + |
| 88 | + describe "#to_param" do |
| 89 | + let(:transcript) { create(:transcript) } |
| 90 | + |
| 91 | + it "returns uid" do |
| 92 | + expect(transcript.to_param).to eq(transcript.uid) |
| 93 | + end |
| 94 | + end |
| 95 | + |
67 | 96 | describe "#speakers" do |
68 | 97 | let(:vendor) { Vendor.create(uid: "voice_base", name: "VoiceBase") } |
69 | 98 | let(:institution) { FactoryBot.create :institution } |
|
78 | 107 | ) |
79 | 108 | end |
80 | 109 | let(:transcript) do |
81 | | - Transcript.create!( |
| 110 | + described_class.create!( |
82 | 111 | uid: "test_transcript", |
83 | 112 | vendor: vendor, |
84 | 113 | collection: collection, |
|
148 | 177 | describe "#get_for_home_page" do |
149 | 178 | let(:collection) { create :collection, :published } |
150 | 179 | let(:params) do |
151 | | - { collections: [collection.title], sort_by: sort_by, |
152 | | - search: "", institution: nil, theme: [""] } |
| 180 | + { |
| 181 | + collections: [collection.title], sort_by: sort_by, search: "", institution: nil, theme: [""] |
| 182 | + } |
153 | 183 | end |
154 | 184 |
|
155 | 185 | before do |
156 | 186 | %w[B A].each do |title| |
157 | | - create :transcript, :published, |
| 187 | + create( |
| 188 | + :transcript, |
| 189 | + :published, |
158 | 190 | title: title, |
159 | 191 | collection: collection, |
160 | 192 | project_uid: "nsw-state-library-amplify", |
161 | 193 | lines: 1 |
| 194 | + ) |
162 | 195 | end |
163 | 196 | end |
164 | 197 |
|
|
175 | 208 | let!(:sort_by) { "" } # blank means random |
176 | 209 |
|
177 | 210 | it "return random records" do |
178 | | - expect(Transcript).to receive(:randomize_list) |
| 211 | + expect(described_class).to receive(:randomize_list) |
179 | 212 | described_class.get_for_home_page(params) |
180 | 213 | end |
181 | 214 | end |
|
216 | 249 | end |
217 | 250 |
|
218 | 251 | it "shows theme1 records" do |
219 | | - expect(described_class.search({ |
220 | | - theme: ["theme1"], |
221 | | - })).to eq([transcript2]) |
| 252 | + expect(described_class.search({ theme: ["theme1"] })).to eq([transcript2]) |
222 | 253 | end |
223 | 254 | end |
224 | 255 | end |
|
0 commit comments