54 lines
1.6 KiB
Ruby
54 lines
1.6 KiB
Ruby
# -*- coding: utf-8 -*-
|
|
require 'spec_helper'
|
|
Capybara.add_selector(:href) do
|
|
xpath {|href| XPath.descendant[XPath.attr(:href).contains(href)] }
|
|
end
|
|
feature 'Beispielsammlung', :type=>:feature do
|
|
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
|
|
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
|
|
user.add_role(:fetuser)
|
|
visit '/'
|
|
find(:href, "sign_in").click
|
|
fill_in 'user_email', with: user.email
|
|
fill_in 'user_password', with:"password"
|
|
click_button 'Sign in'
|
|
click_link 'Startseite'
|
|
end
|
|
def sign_in
|
|
visit '/'
|
|
user.add_role(:fetadmin)
|
|
|
|
find(:href, "sign_in").click
|
|
fill_in 'user_email', with: user.email
|
|
fill_in 'user_password', with:"password"
|
|
click_button 'Sign in'
|
|
end
|
|
scenario 'anonym user visits beispielsammlung' do
|
|
# sign_in
|
|
visit "/"
|
|
click_link 'Beispielsammlung'
|
|
expect(page).to have_text(studium.title)
|
|
# expect(page).to have_tag("link to lva")
|
|
# click_link 'LVA1'
|
|
# expect(page).to have_text(beispiel.name)
|
|
end
|
|
scenario 'load something up' do
|
|
visit "/"
|
|
click_link 'Beispiel hinzufügen'
|
|
page.attach_file('beispiel[beispieldatei]', Rails.root + 'spec/factories/logo2014_64.png')
|
|
click_button "Create Beispiel"
|
|
|
|
# find(:href,"/beispiele/new").click
|
|
|
|
end
|
|
end
|
|
|