improve tests for lva
This commit is contained in:
@@ -98,7 +98,7 @@ class Lva < ActiveRecord::Base
|
|||||||
url
|
url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# this should be more DRY
|
||||||
def load_tissdata
|
def load_tissdata
|
||||||
urlp="https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-"
|
urlp="https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-"
|
||||||
begin
|
begin
|
||||||
@@ -187,7 +187,8 @@ class Lva < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
# Why is this an instance method??
|
||||||
|
# How is it used?
|
||||||
def update_multiple(hash)
|
def update_multiple(hash)
|
||||||
newlvas=[]
|
newlvas=[]
|
||||||
params["lvas"].each do |i,l|
|
params["lvas"].each do |i,l|
|
||||||
@@ -222,7 +223,7 @@ class Lva < ActiveRecord::Base
|
|||||||
lecturers.map { |l| l.name }
|
lecturers.map { |l| l.name }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# is this used? in which context?
|
||||||
def self.update_multiple_with_modul(hash,modul)
|
def self.update_multiple_with_modul(hash,modul)
|
||||||
newlvas=[]
|
newlvas=[]
|
||||||
hash.each do |i,l|
|
hash.each do |i,l|
|
||||||
@@ -248,7 +249,7 @@ class Lva < ActiveRecord::Base
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# is this used? in which context?
|
||||||
def read_et_forum
|
def read_et_forum
|
||||||
lva=self
|
lva=self
|
||||||
url=lva.forumlink
|
url=lva.forumlink
|
||||||
|
|||||||
@@ -35,6 +35,20 @@ describe Lva, :type=>:model do
|
|||||||
|
|
||||||
expect(lva.semester).not_to be_empty
|
expect(lva.semester).not_to be_empty
|
||||||
end
|
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
|
describe "if bare" do
|
||||||
let(:lva) {FactoryGirl.build(:lva)}
|
let(:lva) {FactoryGirl.build(:lva)}
|
||||||
|
|||||||
Reference in New Issue
Block a user