trusty-cms 3.9.2 → 3.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe Admin::WelcomeController, :type => :controller do
4
- routes { TrustyCms::Engine.routes }
5
-
6
- end
@@ -1,92 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe 'Administration Interface Login' do
4
- fixtures :users
5
-
6
- it 'shows a login page' do
7
- visit '/'
8
-
9
- expect(page).to have_field 'Username or E-mail Address'
10
- expect(page).to have_field 'Password'
11
- expect(page).to have_button 'Login'
12
- end
13
-
14
- it 'shows an error if the username is wrong' do
15
- log_in_as 'nonexistent_username'
16
-
17
- expect(find('#error')).to have_content "Invalid username, e-mail address, or password."
18
- end
19
-
20
- describe 'as an admin user' do
21
- before(:each) do
22
- @admin = users(:captain_janeway)
23
- end
24
-
25
- context 'after login' do
26
- before(:each) do
27
- log_in_as @admin.login
28
- end
29
-
30
- it 'shows the admin interface' do
31
- expect(page).to have_content "Logged in as"
32
- end
33
-
34
- it 'has correct links in header' do
35
- expect(page).to have_link @admin.name, href: '/admin/preferences/edit'
36
- expect(page).to have_link 'Logout', href: '/admin/logout'
37
- expect(page).to have_link 'View Site', href: '/'
38
- end
39
-
40
- it 'has correct links in navigation' do
41
- within '#navigation' do
42
- expect(page).to have_link "Content", href: '/admin/pages'
43
- expect(page).to have_link "Design", href: '/admin/layouts'
44
- expect(page).to have_link "Settings", href: '/admin/configuration'
45
- end
46
- end
47
-
48
- it 'outputs table header as html' do
49
- expect(page).to have_selector "table#pages th.name"
50
- end
51
-
52
-
53
- it 'can navigate to create new page' do
54
- visit '/admin/pages/new'
55
- expect(page).to have_selector "h1", text: "New Page"
56
- end
57
-
58
- it 'can log out' do
59
- click_link "Logout"
60
- expect(page).to have_content "You are now logged out."
61
-
62
- visit '/admin/pages/new'
63
- expect(page).to have_content "Please Login"
64
- end
65
- end
66
-
67
- it 'shows an error if the password is wrong' do
68
- log_in_as @admin.login, 'passwordwhoops'
69
-
70
- expect(find('#error')).to have_content "Invalid username, e-mail address, or password."
71
- end
72
- end
73
-
74
- describe 'as a regular user after login' do
75
- before(:each) do
76
- @user = users(:neelix)
77
- log_in_as @user.login
78
- end
79
-
80
- it 'can log in to the admin interface' do
81
- expect(page).to have_content "Logged in as"
82
- end
83
-
84
- it 'has correct links in navigation' do
85
- within '#navigation' do
86
- expect(page).to have_link "Content", href: '/admin/pages'
87
- expect(page).not_to have_link "Design"
88
- expect(page).to have_link "Settings", href: '/admin/configuration'
89
- end
90
- end
91
- end
92
- end
@@ -1,18 +0,0 @@
1
- require "rails_helper"
2
-
3
- RSpec.describe "routes for Welcome", :type => :routing do
4
- it "routes /admin/welcome to the admin/welcome controller" do
5
- expect(get("/admin/welcome")).
6
- to route_to("admin/welcome#index")
7
- end
8
-
9
- it "routes /admin/login to the admin/welcome controller" do
10
- expect(get("/admin/login")).
11
- to route_to("admin/welcome#login")
12
- end
13
-
14
- it "routes /admin/logout to the admin/welcome controller" do
15
- expect(get("/admin/logout")).
16
- to route_to("admin/welcome#logout")
17
- end
18
- end