Upgraded to Rails 4

This commit is contained in:
2019-02-24 15:47:27 +01:00
parent f52ec0411d
commit f809f36c06
86 changed files with 732 additions and 662 deletions

View File

@@ -6,12 +6,12 @@ describe FetprofilesController, :type => :controller do
def self.create_fetprofile
before(:each) do
@fetprofile = FactoryGirl.create(:fetprofile)
@fetprofile = FactoryBot.create(:fetprofile)
end
end
def self.create_active_fetprofile
before(:each) do
@fetprofile = FactoryGirl.create(:fetprofile, active: true)
@fetprofile = FactoryBot.create(:fetprofile, active: true)
end
end
@@ -81,7 +81,7 @@ describe FetprofilesController, :type => :controller do
end
describe "POST create" do
subject(:action){post :create, {:fetprofile => FactoryGirl.attributes_for(:fetprofile),:format=>:html}}
subject(:action){post :create, {:fetprofile => FactoryBot.attributes_for(:fetprofile),:format=>:html}}
login_fet_user
describe "with valid params" do

View File

@@ -6,12 +6,12 @@ describe GremienController, :type => :controller do
def self.create_gremium
before(:each) do
@gremium = FactoryGirl.create(:gremium)
@gremium = FactoryBot.create(:gremium)
end
end
# def self.create_active_gremium
# before(:each) do
# @gremium = FactoryGirl.create(:gremium, active: true)
# @gremium = FactoryBot.create(:gremium, active: true)
# end
# end
@@ -81,7 +81,7 @@ describe GremienController, :type => :controller do
end
describe "POST create" do
subject(:action){post :create, {:gremium => FactoryGirl.attributes_for(:gremium),:format=>:html}}
subject(:action){post :create, {:gremium => FactoryBot.attributes_for(:gremium),:format=>:html}}
login_fet_user
describe "with valid params" do

View File

@@ -3,8 +3,8 @@ require 'spec_helper'
RSpec.describe NeuigkeitenController, :type => :controller do
let(:neuigkeit) {(FactoryGirl.create(:neuigkeit, :with_rubrik))}
let(:intern_neuigkeit) {(FactoryGirl.create(:neuigkeit,:with_intern_rubrik))}
let(:neuigkeit) {(FactoryBot.create(:neuigkeit, :with_rubrik))}
let(:intern_neuigkeit) {(FactoryBot.create(:neuigkeit,:with_intern_rubrik))}
let(:valid_session) {{}}
@@ -34,7 +34,7 @@ RSpec.describe NeuigkeitenController, :type => :controller do
end
it "denys access to unpublished news" do
neuigkeit=FactoryGirl.create(:neuigkeit, :with_rubrik, :unpublished)
neuigkeit=FactoryBot.create(:neuigkeit, :with_rubrik, :unpublished)
get :show, {id: neuigkeit.id}, valid_session
expect(response).to have_http_status(302)
end
@@ -133,7 +133,7 @@ RSpec.describe NeuigkeitenController, :type => :controller do
end
end
describe "POST create" do
let(:action) {post :create, {rubrik_id: neuigkeit.rubrik.id, neuigkeit: FactoryGirl.attributes_for(:neuigkeit)}}
let(:action) {post :create, {rubrik_id: neuigkeit.rubrik.id, neuigkeit: FactoryBot.attributes_for(:neuigkeit)}}
it_behaves_like "it is restricted"

View File

@@ -1,9 +1,9 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :attachment do
name "MyString"
# name "MyString"
datei { Rack::Test::UploadedFile.new(File.join(Rails.root,'public','fetlogo.png'))}
flag_titlepic false
# flag_titlepic false
end
end

View File

@@ -1,10 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :beispiel do
name "BSP1"
desc "sdf"
datum Date.today
#name "BSP1"
#desc "sdf"
#datum Date.today
beispieldatei { Rack::Test::UploadedFile.new(File.join(Rails.root,'public','fetlogo.png'))}
end
end

View File

@@ -1,9 +1,9 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :calendar do
name "MyString"
public false
# name "MyString"
# public false
association :rubrik, factory: :rubrik
end
end

View File

@@ -1,11 +1,11 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :calentry do
start 1.hours.ago
ende "2013-08-05 21:17:10"
summary "MyString"
typ 1
start {1.hours.ago}
ende {1.days.from_now }
summary {"MyString"}
typ {1}
association :calendar, factory: :calendar
end

View File

@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :comment do
end
end

View File

@@ -1,20 +1,20 @@
FactoryGirl.define do
FactoryBot.define do
factory :crawlobject do
name "MyString"
text "MyText"
raw "MyText"
type 1
schematype "MyString"
crawlurl "MyString"
url ""
crawltime "2015-03-30 21:10:29"
published_at "2015-03-30 21:10:29"
referenced ""
parent_id 1
lft 1
rgt 1
depth 1
children_count 1
name {'MyString'}
text {'MyText'}
raw {'MyText'}
type {1}
schematype {"MyString"}
crawlurl {"MyString"}
url {""}
crawltime {"2015-03-30 21:10:29"}
published_at {"2015-03-30 21:10:29"}
referenced {""}
parent_id {1}
lft {1}
rgt {1}
depth {1}
children_count {1}
end
end

View File

@@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
factory :document do
typ 1
name "MyString"
text "MyText"
etherpadkey "MyString"
parent ""
typ {1}
name {"MyString"}
text {"MyText"}
etherpadkey {"MyString"}
parent {""}
end
end

View File

@@ -1,31 +1,31 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :fetprofile do
vorname "MyString"
nachname "MyString"
short "MyString"
fetmailalias "MyString"
desc "MyText"
picture "MyString"
active false
birth_month 4
birth_day 2
vorname {'MyString'}
nachname {"MyString"}
short {"MyString"}
fetmailalias {"MyString"}
desc {"MyText"}
picture {"MyString"}
active {false}
birth_month {4}
birth_day {2}
factory :fetprofile2 do
vorname "Sarah"
nachname "Nachname2"
short "j"
vorname {"Sarah"}
nachname {"Nachname2"}
short {"j"}
end
factory :fetprofile3 do
vorname "Thomas"
nachname "Mustermann"
vorname {"Thomas"}
nachname {"Mustermann"}
end
factory :fetprofile_withadress do
street "some street"
plz "1231"
city "vienna"
telnr "sdf tel nummer"
hdynr "sdf hdy nummer"
street {"some street"}
plz {"1231"}
city {"vienna"}
telnr {"sdf tel nummer"}
hdynr {"sdf hdy nummer"}
end
end
end

View File

@@ -1,10 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :fetznedition do
title "MyString"
desc "MyText"
datum "2013-08-19"
datei "MyString"
title {"MyString"}
desc {"MyText"}
datum {"2013-08-19"}
datei {"MyString"}
end
end

View File

@@ -1,10 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :foto do
title "MyString"
desc "MyText"
gallery_id 1
datei "MyString"
title {"MyString"}
desc {"MyText"}
gallery_id {1}
datei {"MyString"}
end
end

View File

@@ -1,8 +1,8 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :frage do
title "MyString"
text "MyText"
title {"MyString"}
text {"MyText"}
end
end

View File

@@ -1,9 +1,9 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :gallery do
name "MyString"
desc "MyText"
datum "2013-08-19"
name {"MyString"}
desc {"MyText"}
datum {"2013-08-19"}
end
end

View File

@@ -2,10 +2,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :gremium do
name "Kommission"
desc "Das ist eine Kommission die sich mit irgendwas beschäftigt"
typ 1
name {"Kommission"}
desc {"Das ist eine Kommission die sich mit irgendwas beschäftigt"}
typ {1}
end
end

View File

@@ -1,11 +1,11 @@
FactoryGirl.define do
FactoryBot.define do
factory :key do
uuid "MyString"
expire "2015-06-08 21:32:56"
parent ""
type 1
user_id 1
is_valid false
uuid {"MyString"}
expire {"2015-06-08 21:32:56"}
parent {""}
type {1}
user_id {1}
is_valid {false}
end
end

View File

@@ -1,10 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :lecturer do
name "MyString"
email "MyString"
oid 1
picture "MyString"
name {"MyString"}
email {"MyString"}
oid {1}
picture {"MyString"}
end
end

View File

@@ -1,14 +1,14 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :lva do
name "Vorlesung 1"
desc "Das ist eine Vorlesung"
lvanr "001.002"
ects 3
stunden 2
pruefungsinformation "sdf"
lernaufwand "sdf"
typ 'VO'
name {"Vorlesung 1"}
desc {"Das ist eine Vorlesung"}
lvanr { "001.002"}
ects {3}
stunden {2}
pruefungsinformation {"sdf"}
lernaufwand {"sdf"}
typ {'VO'}
end
end

View File

@@ -1,14 +1,14 @@
FactoryGirl.define do
FactoryBot.define do
factory :meeting do
name "MyString"
desc "MyText"
parent nil
intern false
meetingtyp nil
name {"MyString"}
desc {"MyText"}
parent {nil}
intern {false}
meetingtyp {nil}
# association :calentry, factory: :calentry
after(:build) do |c|
c.calentry=FactoryGirl.build(:calentry, typ: 2)
c.calentry=FactoryBot.build(:calentry, typ: 2)
end

View File

@@ -1,9 +1,9 @@
FactoryGirl.define do
FactoryBot.define do
factory :meetingtyp do
name "MyString"
desc "MyText"
agendaintern false
protocolintern false
name {"MyString"}
desc {"MyText"}
agendaintern {false}
protocolintern {false}
association :rubrik, factory: :rubrik
end

View File

@@ -1,12 +1,12 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :membership do
gremium_id 1
fetprofile_id 1
start "2013-08-19"
stop "2013-08-23"
typ 1
gremium_id {1}
fetprofile_id {1}
start {"2013-08-19"}
stop {"2013-08-23"}
typ {1}
end
end

View File

@@ -1,14 +1,14 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :modulgruppe do
typ "Pflicht"
phase 1
name "Pflichtmodule 1"
desc "ASDFASDF"
typ {"Pflicht"}
phase {1}
name {"Pflichtmodule 1"}
desc {"ASDFASDF"}
factory :other_modulgruppe do
name "PFlichtmodule 2"
desc "sdafaswdfsfr"
name {"PFlichtmodule 2"}
desc {"sdafaswdfsfr"}
end
end

View File

@@ -1,11 +1,11 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :modul do
name ""
factory :other_modul do
name "Modul 1"
end
name {""}
factory :other_modul do
name {"Modul 1"}
end
end
end

View File

@@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
sequence (:title) {|n| "Wichtige Neuigkeit #{n}"}
sequence (:text) {|n| "Wichtiger text #{n}"}
factory :neuigkeit do
title
text
datum 1.days.ago
datum {1.days.ago}
association :author, factory: :user
trait :with_rubrik do
@@ -15,14 +15,14 @@ FactoryGirl.define do
end
trait :with_meeting do
after(:build) do |n|
n.meeting=FactoryGirl.build(:meeting, :with_meetingtyp)
n.meeting=FactoryBot.build(:meeting, :with_meetingtyp)
end
end
trait :unpublished do
datum nil
datum {nil}
end
end

View File

@@ -1,11 +1,11 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :nlink do
title "MyString"
sort 1
neuigkeit_id 1
link_id 1
link_type "MyString"
title {"MyString"}
sort {1}
neuigkeit_id {1}
link_id {1}
link_type {"MyString"}
end
end

View File

@@ -1,7 +1,7 @@
FactoryGirl.define do
FactoryBot.define do
factory :rubrik do
name "Allgemeine"
desc "Allgemeine Test News"
public true
name {"Allgemeine"}
desc {"Allgemeine Test News"}
public {true}
end
end

View File

@@ -1,15 +1,15 @@
FactoryGirl.define do
FactoryBot.define do
factory :semester do
nummer 2
nummer {2}
factory :zero_semester do
nummer 0
nummer {0}
end
factory :first_semester do
nummer 1
nummer {1}
end
end
end

View File

@@ -1,18 +1,18 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :studium do
zahl "066506"
name "Automatisierung"
desc "TEST DESC"
typ "Master"
zahl {"066506"}
name {"Automatisierung"}
desc {"TEST DESC"}
typ {"Master"}
factory :other_studium do
name "Telecommunication"
desc "frueher Telekommunikation"
zahl "066507"
typ "Master"
name {"Telecommunication"}
desc {"frueher Telekommunikation"}
zahl {"066507"}
typ {"Master"}
end
end

View File

@@ -1,7 +1,7 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :studium do
zahl "066.506"
name "Automatisierung"

View File

@@ -1,7 +1,7 @@
FactoryGirl.define do
FactoryBot.define do
factory :survey_answer, :class => 'Survey::Answer' do
choice nil
user nil
choice {nil}
user {nil}
end
end

View File

@@ -1,9 +1,9 @@
FactoryGirl.define do
FactoryBot.define do
factory :survey_choice, :class => 'Survey::Choice' do
text "MyString"
question nil
sort 1
picture "MyString"
text {"MyString"}
question {nil}
sort {1}
picture {"MyString"}
end
end

View File

@@ -1,8 +1,8 @@
FactoryGirl.define do
FactoryBot.define do
factory :survey_question, :class => 'Survey::Question' do
title "MyString"
text "MyText"
typ 1
title {"MyString"}
text {"MyText"}
typ {1}
end
end

View File

@@ -1,8 +1,8 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :thema do
title "MyString"
text "MyText"
title {"MyString"}
text {"MyText"}
end
end

View File

@@ -1,8 +1,8 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
FactoryBot.define do
factory :themengruppe, :class => 'Themengruppe' do
title "MyString"
text "MyText"
title {"MyString"}
text {"MyText"}
end
end

View File

@@ -1,11 +1,11 @@
FactoryGirl.define do
FactoryBot.define do
sequence (:email) {|n| "testuser#{n}@fet.at"}
factory :user do
email
password "password"
password_confirmation "password"
password {"password"}
password_confirmation {"password"}
factory :other_user do
email "othertest@test.at"
email {"othertest@test.at"}
end
trait :fetuser do
after(:create) do |user|

View File

@@ -5,15 +5,15 @@ Capybara.add_selector(:href) do
end
feature 'Administration', :type=> :feature do
let!(:user) {FactoryGirl.create(:user)}
let!(:rubrik) {FactoryGirl.create(:rubrik)}
let!(:user) {FactoryBot.create(:user)}
let!(:rubrik) {FactoryBot.create(:rubrik)}
let!(:themengruppe){ FactoryGirl.create(:themengruppe) }
let!(:studium) {FactoryGirl.create(:studium,:visible=>true)}
let!(:themengruppe){ FactoryBot.create(:themengruppe) }
let!(:studium) {FactoryBot.create(:studium,:visible=>true)}
before(:each) do
FactoryGirl.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
FactoryGirl.create(:thema, id: t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml").to_i, themengruppe_id: themengruppe.id)
FactoryBot.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
FactoryBot.create(:thema, id: t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml").to_i, themengruppe_id: themengruppe.id)
studium.id
end
def sign_in

View File

@@ -4,13 +4,13 @@ Capybara.add_selector(:href) do
xpath {|href| XPath.descendant[XPath.attr(:href).contains(href)] }
end
feature 'Beispielsammlung', :type=>:feature do
let!(:rubrik) {FactoryGirl.create(:rubrik)}
let!(:user) {FactoryGirl.create(:user)}
let!(:themengruppe){ FactoryGirl.create(:themengruppe) }
let!(:studium) {FactoryGirl.create(:studium,:visible=>true)}
let!(:rubrik) {FactoryBot.create(:rubrik)}
let!(:user) {FactoryBot.create(:user)}
let!(:themengruppe){ FactoryBot.create(:themengruppe) }
let!(:studium) {FactoryBot.create(:studium,:visible=>true)}
before(:each) do
FactoryGirl.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
FactoryGirl.create(:thema, id: t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml").to_i, themengruppe_id: themengruppe.id)
FactoryBot.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
FactoryBot.create(:thema, id: t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml").to_i, themengruppe_id: themengruppe.id)
studium.id
end
scenario 'login' do

View File

@@ -6,11 +6,11 @@ include Rails.application.routes.url_helpers
describe 'neuigkeit_mail' do
before(:each) do
rubrik = FactoryGirl.create(:rubrik)
@neuigkeit=FactoryGirl.create(:neuigkeit, author_id: user.id, rubrik_id: rubrik.id)
rubrik = FactoryBot.create(:rubrik)
@neuigkeit=FactoryBot.create(:neuigkeit, author_id: user.id, rubrik_id: rubrik.id)
NewsMailer.stub(:default_url_options).and_return({host:"localhost", port: 3000})
end
let(:user) {User.first || FactoryGirl.create(:user)}
let(:user) {User.first || FactoryBot.create(:user)}
let(:email) {"test@mail.com"}
let(:neuigkeit) {@neuigkeit}

View File

@@ -2,7 +2,7 @@ require 'spec_helper'
describe Attachment do
pending "add some examples to (or delete) #{__FILE__}"
let(:attachment) {FactoryGirl.build_stubbed(:attachment)}
let(:attachment) {FactoryBot.build_stubbed(:attachment)}
it "responds to image" do
expect(attachment.respond_to?(:image?)).to be true
end

View File

@@ -3,25 +3,25 @@ require 'spec_helper'
describe Beispiel, :type=>:model do
let_studium_lva
# before(:each) do
# s=FactoryGirl.create(:studium)
# mg=FactoryGirl.create(:modulgruppe, studium_id: s.id)#
# s=FactoryBot.create(:studium)
# mg=FactoryBot.create(:modulgruppe, studium_id: s.id)#
# m=FactoryGirl.build(:other_modul)
# m=FactoryBot.build(:other_modul)
# m.modulgruppen << mg
# m.save!
# @l=FactoryGirl.build(:lva)
# @l=FactoryBot.build(:lva)
# @l.modul << m
# @l.save!
# end
let(:lva){FactoryGirl.build_stubbed(:lva)}
let(:beispiel){FactoryGirl.build(:beispiel, lva: lva)}
let(:lva){FactoryBot.build_stubbed(:lva)}
let(:beispiel){FactoryBot.build(:beispiel, lva: lva)}
it "should be created" do
expect{beispiel.save!; Sunspot.commit}.to change{Beispiel.count}.by(1)
end
it "is not valid without lva" do
b=FactoryGirl.build(:beispiel)
b=FactoryBot.build(:beispiel)
expect(b.valid?).to be false
end
it "responds to comments" do

View File

@@ -2,8 +2,8 @@ require 'spec_helper'
describe Calendar do
pending "add some examples to (or delete) #{__FILE__}"
let(:rubrik) {FactoryGirl.create(:rubrik)}
let(:calendar) {FactoryGirl.build(:calendar, rubrik_id: rubrik.id)}
let(:rubrik) {FactoryBot.create(:rubrik)}
let(:calendar) {FactoryBot.build(:calendar, rubrik_id: rubrik.id)}
it "should be valid" do
expect(calendar).to be_valid
end

View File

@@ -2,11 +2,11 @@ require 'spec_helper'
describe Calentry do
let(:rubrik) {FactoryGirl.create(:rubrik)}
let(:user) {FactoryGirl.create(:user)}
let(:calendar) {FactoryGirl.create(:calendar,updated_at: 1.hour.ago)}
let(:neuigkeit) {FactoryGirl.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id, updated_at: 1.hour.ago)}
subject(:calentry) {FactoryGirl.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id)}
let(:rubrik) {FactoryBot.create(:rubrik)}
let(:user) {FactoryBot.create(:user)}
let(:calendar) {FactoryBot.create(:calendar,updated_at: 1.hour.ago)}
let(:neuigkeit) {FactoryBot.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id, updated_at: 1.hour.ago)}
subject(:calentry) {FactoryBot.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id)}
it "is valid with full data" do
expect(calentry).to be_valid
@@ -14,7 +14,7 @@ describe Calentry do
[:ende,:start,:typ].each do |attr|
it "is not valid without #{attr}" do
e= FactoryGirl.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id, attr => nil)
e= FactoryBot.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id, attr => nil)
expect(e).not_to be_valid
expect(e).to have_at_least(1).errors_on(attr)
end

View File

@@ -3,22 +3,22 @@ require 'spec_helper'
describe Fetprofile do
[:vorname,:nachname].each do |attr|
it "should not be valid without #{attr}" do
fp = FactoryGirl.build(:fetprofile)
fp = FactoryBot.build(:fetprofile)
fp.send("#{attr}=".to_sym,nil)
fp.should_not be_valid
end
end
it "should be created" do
fp=Fetprofile.new(FactoryGirl.attributes_for(:fetprofile))
fp=Fetprofile.new(FactoryBot.attributes_for(:fetprofile))
expect(fp.save).to be true
end
it "should be valid" do
fp = FactoryGirl.build(:fetprofile)
fp = FactoryBot.build(:fetprofile)
fp.should be_valid
end
it "should not be valid with short name" do
fp = FactoryGirl.build(:fetprofile)
fp = FactoryBot.build(:fetprofile)
fp.nachname ="S"
fp.should_not be_valid
fp.vorname ="d"

View File

@@ -1,13 +1,13 @@
require 'spec_helper'
describe Gremium do
let(:gremium) {FactoryGirl.build(:gremium)}
let(:gremium) {FactoryBot.build(:gremium)}
let(:object_variable){gremium}
it_behaves_like "a valid object"
[:name,:typ].each do |attr|
it "is not valid without #{attr}" do
g = FactoryGirl.build(:gremium,attr.to_sym => nil)
g = FactoryBot.build(:gremium,attr.to_sym => nil)
expect(g).not_to be_valid
expect(g.errors[attr]).to have_at_least(1).items
end
@@ -18,33 +18,33 @@ describe Gremium do
it "is not valid with wrong typ" do
((-5..30).to_a-Gremium::TYPEN.keys()).each do |i|
g = FactoryGirl.build(:gremium, typ: i)
g = FactoryBot.build(:gremium, typ: i)
expect(g).not_to be_valid
end
end
it "is in tabs if typ is 1" do
g = FactoryGirl.create(:gremium, typ: 1)
g = FactoryBot.create(:gremium, typ: 1)
expect(Gremium.tabs).to eq([g])
end
it "is not in tabs if typ is not 1 or 3" do
g = FactoryGirl.create(:gremium, typ: 2)
g = FactoryBot.create(:gremium, typ: 2)
expect(Gremium.tabs).to eq([])
end
it "destroys memberships if its destroyed" do
g=FactoryGirl.create(:gremium)
fp=FactoryGirl.create(:fetprofile)
m=FactoryGirl.create(:membership, gremium_id: g.id, fetprofile_id: fp.id)
g=FactoryBot.create(:gremium)
fp=FactoryBot.create(:fetprofile)
m=FactoryBot.create(:membership, gremium_id: g.id, fetprofile_id: fp.id)
expect{g.destroy}.to change {Membership.count}.by(-1)
end
it "responds to title" do
g=FactoryGirl.build(:gremium)
g=FactoryBot.build(:gremium)
expect(g.respond_to?(:title)).to be true
end
end

View File

@@ -51,7 +51,7 @@ describe Lva, :type=>:model do
end
describe "if bare" do
let(:lva) {FactoryGirl.build(:lva)}
let(:lva) {FactoryBot.build(:lva)}
it "should be created" do
l=lva
l.modul << modul

View File

@@ -1,12 +1,12 @@
require 'spec_helper'
RSpec.describe Meeting, :type => :model do
let(:user){FactoryGirl.create(:user)}
let(:rubrik) {FactoryGirl.create(:rubrik)}
let(:calendar){FactoryGirl.create(:calendar, rubrik_id: rubrik.id)}
let(:calentry){FactoryGirl.build(:calentry, calendar_id: calendar.id, typ: 2)}
let(:meetingtyp){FactoryGirl.create(:meetingtyp, rubrik_id: rubrik.id)}
let(:meeting){FactoryGirl.build(:meeting, meetingtyp_id: meetingtyp.id)}
let(:user){FactoryBot.create(:user)}
let(:rubrik) {FactoryBot.create(:rubrik)}
let(:calendar){FactoryBot.create(:calendar, rubrik_id: rubrik.id)}
let(:calentry){FactoryBot.build(:calentry, calendar_id: calendar.id, typ: 2)}
let(:meetingtyp){FactoryBot.create(:meetingtyp, rubrik_id: rubrik.id)}
let(:meeting){FactoryBot.build(:meeting, meetingtyp_id: meetingtyp.id)}
let(:object_variable) {meeting}
it_behaves_like "a valid object"
@@ -27,7 +27,7 @@ RSpec.describe Meeting, :type => :model do
expect(meeting).to be_valid
end
context "without calentry" do
# let(:meeting){FactoryGirl.build(:meeting, :without_calentry, meetingtyp_id: meetingtyp.id)}
# let(:meeting){FactoryBot.build(:meeting, :without_calentry, meetingtyp_id: meetingtyp.id)}
it "should be creating a calentry typ 2" do
meeting.create_calentry

View File

@@ -2,8 +2,8 @@ require 'spec_helper'
RSpec.describe Meetingtyp, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
let(:rubrik) {FactoryGirl.create(:rubrik)}
let(:meetingtyp){FactoryGirl.build(:meetingtyp, rubrik_id: rubrik.id)}
let(:rubrik) {FactoryBot.create(:rubrik)}
let(:meetingtyp){FactoryBot.build(:meetingtyp, rubrik_id: rubrik.id)}
it "should be created" do
expect(meetingtyp).to be_valid
expect(meetingtyp.save).to be true

View File

@@ -3,14 +3,14 @@ require 'spec_helper'
describe Modul do
[:name].each do |attr|
it "should not be valid without #{attr}" do
modul = FactoryGirl.build(:modul)
modul = FactoryBot.build(:modul)
modul.send("#{attr}=".to_sym,nil)
expect(modul).not_to be_valid
expect(modul).to have_at_least(1).errors_on(attr)
end
end
it "is valid with everything" do
m = FactoryGirl.build(:modul)
m = FactoryBot.build(:modul)
expect(m).to be_valid
end
end

View File

@@ -2,42 +2,42 @@ require 'spec_helper'
describe Modulgruppe, :type =>:model do
it "should not be valid without studium" do
mg=FactoryGirl.build(:modulgruppe)
mg=FactoryBot.build(:modulgruppe)
mg.should_not be_valid
mg.should have(1).errors_on(:studium_id)
end
it "should be valid with studium" do
s=FactoryGirl.create(:studium)
mg=FactoryGirl.build(:modulgruppe)
s=FactoryBot.create(:studium)
mg=FactoryBot.build(:modulgruppe)
mg.studium=s
mg.should be_valid
end
it "should not be valid without name" do
s=FactoryGirl.create(:studium)
mg=FactoryGirl.build(:modulgruppe)
s=FactoryBot.create(:studium)
mg=FactoryBot.build(:modulgruppe)
mg.studium=s
mg.name=nil
mg.should_not be_valid
mg.should have_at_least(1).errors_on(:name)
end
xit "should not be valid with dubble name" do
s=FactoryGirl.create(:studium)
mg=FactoryGirl.build(:modulgruppe, name: "Gruppe 1", desc: "132")
s=FactoryBot.create(:studium)
mg=FactoryBot.build(:modulgruppe, name: "Gruppe 1", desc: "132")
mg.studium=s
mg.save
mg=FactoryGirl.build(:modulgruppe, name: "Gruppe 2", desc: "133")
mg=FactoryBot.build(:modulgruppe, name: "Gruppe 2", desc: "133")
mg.studium=s
mg.should_not be_valid
mg.should have_at_least(1).errors_on(:name)
end
it "should be valid with same name on different studien" do
s=FactoryGirl.create(:studium)
s2=FactoryGirl.create(:other_studium)
mg=FactoryGirl.build(:modulgruppe, name: "Gruppe")
s=FactoryBot.create(:studium)
s2=FactoryBot.create(:other_studium)
mg=FactoryBot.build(:modulgruppe, name: "Gruppe")
mg.studium=s
mg.save
mg=FactoryGirl.build(:other_modulgruppe, name: "Gruppe")
mg=FactoryBot.build(:other_modulgruppe, name: "Gruppe")
mg.studium=s2
mg.should be_valid

View File

@@ -2,13 +2,13 @@ require 'spec_helper'
describe Neuigkeit do
let(:neuigkeit) {(FactoryGirl.build(:neuigkeit, :with_rubrik))}
let(:intern_neuigkeit) {FactoryGirl.build(:neuigkeit, :with_intern_rubrik)}
let(:unpublished_neuigkeit){FactoryGirl.build(:neuigkeit, :unpublished,:with_rubrik)}
let(:attachment) {FactoryGirl.build_stubbed(:attachment)}
let(:neuigkeit) {(FactoryBot.build(:neuigkeit, :with_rubrik))}
let(:intern_neuigkeit) {FactoryBot.build(:neuigkeit, :with_intern_rubrik)}
let(:unpublished_neuigkeit){FactoryBot.build(:neuigkeit, :unpublished,:with_rubrik)}
let(:attachment) {FactoryBot.build_stubbed(:attachment)}
let(:calentry) {
FactoryGirl.build(:calentry, start: 1.hour.ago, ende: 5.minutes.ago)
FactoryBot.build(:calentry, start: 1.hour.ago, ende: 5.minutes.ago)
}
let(:object_variable) {neuigkeit}
@@ -40,7 +40,7 @@ describe Neuigkeit do
end
context "with meeting" do
let(:neuigkeit) {(FactoryGirl.build(:neuigkeit, :with_rubrik, :with_meeting))}
let(:neuigkeit) {(FactoryBot.build(:neuigkeit, :with_rubrik, :with_meeting))}
let(:object_variable) {neuigkeit}
it_behaves_like "a valid object"
it "has meeting" do expect(neuigkeit.meeting).to be_truthy end

View File

@@ -2,7 +2,7 @@ require 'spec_helper'
describe Rubrik do
pending "add some examples to (or delete) #{__FILE__}"
let(:rubrik){FactoryGirl.create(:rubrik)}
let(:rubrik){FactoryBot.create(:rubrik)}
it "should be valid" do
expect(rubrik).to be_valid
end

View File

@@ -2,12 +2,12 @@ require 'spec_helper'
describe Studium do
# test if it is invalid if certain attributes are missing
let(:studium) { FactoryGirl.build(:studium)}
let(:studium) { FactoryBot.build(:studium)}
let(:object_variable) {studium}
[:name, :zahl].each do |attr|
it "should not be valid without #{attr}" do
s = FactoryGirl.build(:studium, attr=>nil)
s = FactoryBot.build(:studium, attr=>nil)
expect(s).not_to be_valid
end
end
@@ -15,12 +15,12 @@ describe Studium do
it_behaves_like "a valid object"
it "should create studium with valid data" do
s=FactoryGirl.build(:studium)
s=FactoryBot.build(:studium)
lambda {
s.save!; Sunspot.commit}.should change {Studium.count()}.by(1)
end
it "should not accept double entrys" do
FactoryGirl.create(:studium)
FactoryBot.create(:studium)
expect(studium).not_to be_valid
@@ -28,14 +28,14 @@ describe Studium do
expect(studium).to have_at_least(1).error_on(:zahl)
end
it "expect zahl to be 000.000" do
s=FactoryGirl.build(:studium, :zahl=>"000.000")
s=FactoryBot.build(:studium, :zahl=>"000.000")
#Sunspot.commit
s.should_not be_valid
expect(s.errors.size).to be > 0
end
it "is not valid with a short zahl" do
s=FactoryGirl.build(:studium, :zahl=>"123")
s=FactoryBot.build(:studium, :zahl=>"123")
expect(s).not_to be_valid
end

View File

@@ -4,15 +4,15 @@ describe Thema do
[:text, :title].each do |attr|
it "should not be valid without #{attr}" do
tg=FactoryGirl.build(:themengruppe)
t = FactoryGirl.build(:thema, attr=>nil)
tg=FactoryBot.build(:themengruppe)
t = FactoryBot.build(:thema, attr=>nil)
t.themengruppe=tg
t.should_not be_valid
end
end
it "should not be valid without Themengruppe" do
tg=FactoryGirl.build(:themengruppe)
t = FactoryGirl.build(:thema)
tg=FactoryBot.build(:themengruppe)
t = FactoryBot.build(:thema)
t.should_not be_valid
end

View File

@@ -3,7 +3,7 @@ require 'spec_helper'
describe Themengruppe do
[:text, :title].each do |attr|
it "should not be valid without #{attr}" do
tg=FactoryGirl.build(:themengruppe, attr=>nil)
tg=FactoryBot.build(:themengruppe, attr=>nil)
tg.should_not be_valid
end
end

View File

@@ -2,7 +2,7 @@ module ControllerMacros
# include Devise::TestHelpers, :type=>:controller
def with_fet_user
let(:fet_user) {FactoryGirl.create(:other_user, :fetuser)}
let(:fet_user) {FactoryBot.create(:other_user, :fetuser)}
before(:each) do
allow(@controller).to receive(:current_user).and_return(fet_user)
@@ -12,7 +12,7 @@ module ControllerMacros
def with_fet_admin
let(:fet_user)do
fet_user=FactoryGirl.create(:other_user)
fet_user=FactoryBot.create(:other_user)
fet_user.add_role("fetadmin")
fet_user
end
@@ -25,7 +25,7 @@ module ControllerMacros
def login_fet_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
user = FactoryGirl.build(:other_user)
user = FactoryBot.build(:other_user)
user = User.find_by_email(user.email) || user
user.save
user.add_role(:fetuser)
@@ -36,7 +36,7 @@ module ControllerMacros
def login_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
user = FactoryGirl.build(:other_user)
user = FactoryBot.build(:other_user)
user = User.find_by_email(user.email) || user
user.save
# user.confirm!

View File

@@ -1,18 +1,18 @@
module ModelMacros
def let_studium_lva
let(:studium) {FactoryGirl.create(:studium)}
let(:studium) {FactoryBot.create(:studium)}
let(:zerosemester) {FactoryGirl.create(:zero_semester,studium_id: studium.id)}
let(:firstsemester) {FactoryGirl.create(:first_semester)}
let(:modulgruppe){FactoryGirl.create(:modulgruppe,studium_id: studium.id)}
let(:zerosemester) {FactoryBot.create(:zero_semester,studium_id: studium.id)}
let(:firstsemester) {FactoryBot.create(:first_semester)}
let(:modulgruppe){FactoryBot.create(:modulgruppe,studium_id: studium.id)}
let(:modul) do
m=FactoryGirl.build(:other_modul)
m=FactoryBot.build(:other_modul)
m.modulgruppen << modulgruppe
m.save!
m
end
let(:lva) do
l=FactoryGirl.build(:lva)
l=FactoryBot.build(:lva)
l.modul << modul
l
end

View File

@@ -14,7 +14,7 @@ module ViewMacros
def login_fet_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
user = FactoryGirl.build(:user)
user = FactoryBot.build(:user)
user = User.find_by_email(user.email) || user
user.save
user.add_role(:fetuser)
@@ -29,7 +29,7 @@ module ViewMacros
def login_fetadmin_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
user = FactoryGirl.build(:user)
user = FactoryBot.build(:user)
user = User.find_by_email(user.email) || user
user.save
user.add_role(:fetadmin)

View File

@@ -4,7 +4,7 @@ describe "fetprofiles/edit", :type=> :view do
foreach_theme do
login_fet_user
before(:each) do
@fetprofile = FactoryGirl.create(:fetprofile_withadress,:skype => "myskypename")
@fetprofile = FactoryBot.create(:fetprofile_withadress,:skype => "myskypename")
@memberships = []
end

View File

@@ -6,9 +6,9 @@ include Devise::TestHelpers
include Rails.application.routes.url_helpers
before(:each) do
# @fetprofile =
#assign(:fetprofile, stub_model(Fetprofile, FactoryGirl.attributes_for(:fetprofile)))
#assign(:fetprofile, stub_model(Fetprofile, FactoryBot.attributes_for(:fetprofile)))
default_url_options[:locale] = :de
@fetprofile = FactoryGirl.create(:fetprofile)
@fetprofile = FactoryBot.create(:fetprofile)
# assign(:fetprofile,@fetprofile)
# assign(:memberships, [])
end

View File

@@ -5,10 +5,10 @@ describe "fetprofiles/index" , :type=>:view do
foreach_theme do
before(:each) do
# default_url_options[:locale] = :de
@fetprofile1 = FactoryGirl.create(:fetprofile)
@fetprofile2 = FactoryGirl.create(:fetprofile2)
@fetprofile3 = FactoryGirl.create(:fetprofile3)
@fetprofile4 = FactoryGirl.create(:fetprofile_withadress)
@fetprofile1 = FactoryBot.create(:fetprofile)
@fetprofile2 = FactoryBot.create(:fetprofile2)
@fetprofile3 = FactoryBot.create(:fetprofile3)
@fetprofile4 = FactoryBot.create(:fetprofile_withadress)
@fetprofiles=[@fetprofile1, @fetprofile2, @fetprofile3, @fetprofile4]
assign(:fetprofiles,@fetprofiles)
assign(:gremientabs, [])

View File

@@ -3,7 +3,7 @@ require 'spec_helper'
describe "fetprofiles/new", :type=> :view do
foreach_theme do
before(:each) do
@fetprofile = FactoryGirl.create(:fetprofile_withadress,:skype => "myskypename")
@fetprofile = FactoryBot.create(:fetprofile_withadress,:skype => "myskypename")
@memberships = []
end

View File

@@ -5,13 +5,13 @@ describe "fetprofiles/show", :type => :view do
before(:each) do
default_url_options[:locale] = :de
@fetprofile = FactoryGirl.create(:fetprofile_withadress)
@fetprofile = FactoryBot.create(:fetprofile_withadress)
assign(:fetprofile,@fetprofile)
@gremium = FactoryGirl.create(:gremium)
@gremium2 = FactoryGirl.create(:gremium, name:"Kommission2")
@gremium3 = FactoryGirl.create(:gremium, name:"Kommission3", typ: 2)
@gremium = FactoryBot.create(:gremium)
@gremium2 = FactoryBot.create(:gremium, name:"Kommission2")
@gremium3 = FactoryBot.create(:gremium, name:"Kommission3", typ: 2)
assign(:memberships, [FactoryGirl.create(:membership,gremium_id: @gremium.id, fetprofile_id: @fetprofile.id)])
assign(:memberships, [FactoryBot.create(:membership,gremium_id: @gremium.id, fetprofile_id: @fetprofile.id)])
assign(:gremientabs, [@gremium2])
# view.theme "blue2"
end