mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
a start on the index tests
This commit is contained in:
parent
9a31ecb1a1
commit
b9530b3d43
2 changed files with 67 additions and 1 deletions
66
tests/acceptance/index_tests.rb
Normal file
66
tests/acceptance/index_tests.rb
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
require_relative './environment.rb'
|
||||||
|
|
||||||
|
describe '/' do
|
||||||
|
include Capybara::DSL
|
||||||
|
|
||||||
|
describe 'news feed' do
|
||||||
|
before do
|
||||||
|
@site = Fabricate :site
|
||||||
|
page.set_rack_session id: @site.id
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'loads the news feed with welcome' do
|
||||||
|
visit '/'
|
||||||
|
page.body.must_match /Neocities news feed/i
|
||||||
|
page.body.must_match /You aren’t following any websites yet/i
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'displays a follow and an unrelated follow' do
|
||||||
|
@followed_site = Fabricate :site
|
||||||
|
@site.toggle_follow @followed_site
|
||||||
|
@another_site = Fabricate :site
|
||||||
|
@followed_site.toggle_follow @another_site
|
||||||
|
visit '/'
|
||||||
|
find('.news-item', match: :first).text.must_match /#{@followed_site.username} followed #{@another_site.username}/i
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'loads my activities only' do
|
||||||
|
@followed_site = Fabricate :site
|
||||||
|
@site.toggle_follow @followed_site
|
||||||
|
@another_site = Fabricate :site
|
||||||
|
@followed_site.toggle_follow @another_site
|
||||||
|
visit '/?activity=mine'
|
||||||
|
find('.news-item').text.must_match //i
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'loads a specific event with the id' do
|
||||||
|
@followed_site = Fabricate :site
|
||||||
|
@site.toggle_follow @followed_site
|
||||||
|
visit "/?event_id=#{@followed_site.events.first.id}"
|
||||||
|
find('.news-item').text.must_match /you followed #{@followed_site.username}/i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'static pages' do
|
||||||
|
include Capybara::DSL
|
||||||
|
|
||||||
|
it 'loads static info pages' do
|
||||||
|
links = [
|
||||||
|
['About', 'about'],
|
||||||
|
['Tutorials', 'tutorials'],
|
||||||
|
['Donate', 'donate'],
|
||||||
|
['API', 'api'],
|
||||||
|
['Terms', 'terms'],
|
||||||
|
['Privacy', 'privacy'],
|
||||||
|
['Press', 'press']
|
||||||
|
]
|
||||||
|
|
||||||
|
links.each do |l|
|
||||||
|
visit '/'
|
||||||
|
find('a', text: l.first, match: :first).click
|
||||||
|
page.status_code.must_equal 200
|
||||||
|
page.current_path.must_equal "/#{l.last}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -9,8 +9,8 @@
|
||||||
<nav class="footer-Nav col col-40">
|
<nav class="footer-Nav col col-40">
|
||||||
<ul class="tiny h-Nav">
|
<ul class="tiny h-Nav">
|
||||||
<li><a href="/about">About</a></li>
|
<li><a href="/about">About</a></li>
|
||||||
|
<li><a href="/donate">Donate</a></li>
|
||||||
<li><a href="/blog">Blog</a></li>
|
<li><a href="/blog">Blog</a></li>
|
||||||
<li><a href="/api">API</a></li>
|
|
||||||
<li><a href="/press">Press</a></li>
|
<li><a href="/press">Press</a></li>
|
||||||
<li><a href="/terms" rel="nofollow">Terms</a></li>
|
<li><a href="/terms" rel="nofollow">Terms</a></li>
|
||||||
<li><a href="/privacy" rel="nofollow">Privacy</a></li>
|
<li><a href="/privacy" rel="nofollow">Privacy</a></li>
|
||||||
|
|
Loading…
Add table
Reference in a new issue