blob: 96d715ef383130d7b8e636f352aef233884891a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
require 'spec_helper'
feature 'Admin Appearance', feature: true do
let!(:appearance) { create(:appearance) }
scenario 'Create new appearance' do
login_as :admin
visit admin_appearances_path
fill_in 'appearance_title', with: 'MyCompany'
fill_in 'appearance_description', with: 'dev server'
click_button 'Save'
expect(current_path).to eq admin_appearances_path
expect(page).to have_content 'Appearance settings'
expect(page).to have_field('appearance_title', with: 'MyCompany')
expect(page).to have_field('appearance_description', with: 'dev server')
expect(page).to have_content 'Last edit'
end
scenario 'Preview appearance' do
login_as :admin
visit admin_appearances_path
click_link "Preview"
expect_page_has_custom_appearance(appearance)
end
scenario 'Custom sign-in page' do
visit new_user_session_path
expect_page_has_custom_appearance(appearance)
end
scenario 'Appearance logo' do
login_as :admin
visit admin_appearances_path
attach_file(:appearance_logo, logo_fixture)
click_button 'Save'
expect(page).to have_css(logo_selector)
click_link 'Remove logo'
expect(page).not_to have_css(logo_selector)
end
scenario 'Header logos' do
login_as :admin
visit admin_appearances_path
attach_file(:appearance_header_logo, logo_fixture)
click_button 'Save'
expect(page).to have_css(header_logo_selector)
click_link 'Remove header logo'
expect(page).not_to have_css(header_logo_selector)
end
def expect_page_has_custom_appearance(appearance)
expect(page).to have_content appearance.title
expect(page).to have_content appearance.description
end
def logo_selector
'//img[@src^="/uploads/appearance/logo"]'
end
def header_logo_selector
'//img[@src^="/uploads/appearance/header_logo"]'
end
def logo_fixture
Rails.root.join('spec', 'fixtures', 'dk.png')
end
end
|