forked from bofh/fetsite
AutoCommit Fre Sep 11 21:03:01 CEST 2015
This commit is contained in:
@@ -7,11 +7,11 @@
|
|||||||
<%= current_user.email %> is logged in.
|
<%= current_user.email %> is logged in.
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li><%= link_to('Logout', destroy_user_session_path, :method => :delete) %> </li>
|
<li><%= link_to('Logout', destroy_user_session_path, :method => :delete,:id => "login_link") %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to('Login', new_user_session_path) %>
|
<%= link_to('Login', new_user_session_path, id:"login_link") %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,9 +1,38 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
Capybara.add_selector(:href) do
|
||||||
|
xpath {|href| XPath.descendant[XPath.attr(:href).contains(href)] }
|
||||||
|
end
|
||||||
feature 'Beispielsammlung', :type=>:feature do
|
feature 'Beispielsammlung', :type=>:feature do
|
||||||
scenario 'anonym user visits beispielsammlung' do
|
let!(:rubrik) {FactoryGirl.create(:rubrik)}
|
||||||
|
let!(:user) {FactoryGirl.create(:user)}
|
||||||
|
let!(:themengruppe){ FactoryGirl.create(:themengruppe) }
|
||||||
|
let!(:studium) {FactoryGirl.create(:studium)}
|
||||||
|
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)
|
||||||
|
studium.id
|
||||||
|
end
|
||||||
|
scenario 'login' do
|
||||||
|
user.add_role(:fetuser)
|
||||||
visit '/'
|
visit '/'
|
||||||
click_link 'Beispielsammlung'
|
find(:href, "sign_in").click
|
||||||
expect(page).to have_text("Elektrotechnik")
|
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 '/'
|
||||||
|
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 "/studien/#{studium.id}"
|
||||||
|
# click_link 'Beispielsammlung'
|
||||||
|
expect(page).to have_text(studium.title)
|
||||||
# expect(page).to have_tag("link to lva")
|
# expect(page).to have_tag("link to lva")
|
||||||
# click_link 'LVA1'
|
# click_link 'LVA1'
|
||||||
# expect(page).to have_text(beispiel.name)
|
# expect(page).to have_text(beispiel.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user