improve tests for lva

This commit is contained in:
2019-01-05 16:18:30 +01:00
parent f7f8937197
commit ff20774889
2 changed files with 19 additions and 4 deletions

View File

@@ -98,7 +98,7 @@ class Lva < ActiveRecord::Base
url
end
# this should be more DRY
def load_tissdata
urlp="https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-"
begin
@@ -187,7 +187,8 @@ class Lva < ActiveRecord::Base
end
end
# Why is this an instance method??
# How is it used?
def update_multiple(hash)
newlvas=[]
params["lvas"].each do |i,l|
@@ -222,7 +223,7 @@ class Lva < ActiveRecord::Base
lecturers.map { |l| l.name }
end
end
# is this used? in which context?
def self.update_multiple_with_modul(hash,modul)
newlvas=[]
hash.each do |i,l|
@@ -248,7 +249,7 @@ class Lva < ActiveRecord::Base
end
# is this used? in which context?
def read_et_forum
lva=self
url=lva.forumlink

View File

@@ -35,6 +35,20 @@ describe Lva, :type=>:model do
expect(lva.semester).not_to be_empty
end
it "can create a valid tiss link" do
lva.lvanr="101.679"
tl=lva.tisslink
expect(tl).to match "101679"
expect(tl).to match "tiss.tuwien.ac.at"
end
it "should be able to load tissdata" do
lva.lvanr="101.679"
n=lva.name
expect(lva.name).to eq(n)
lva.load_tissdata
expect(lva.name).not_to eq(n)
end
describe "if bare" do
let(:lva) {FactoryGirl.build(:lva)}