Skip to content

Commit 38c5ef5

Browse files
committed
Adjust specs for empact AND master
1 parent 6fce271 commit 38c5ef5

File tree

12 files changed

+44
-21
lines changed

12 files changed

+44
-21
lines changed

app/assets/javascripts/avatar.js.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AvatarCropper
1212

1313
update: (coords) =>
1414
if $('#avatar_original').val() <= 100
15-
alert "<= 100"
15+
alert "WARNING: Image is to small min 100px!"
1616
scale = parseInt($('#avatar_original').val()) / parseInt($('#avatar_large').val())
1717
$('#crop_x').val(coords.x*scale)
1818
$('#crop_y').val(coords.y*scale)

app/controllers/application_controller.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def can_execute?(what)
6464

6565
def ensure_locale
6666
set_locale = I18n.default_locale
67-
return unless Settings.multilanuage == true
67+
return if Settings.multilanuage == false
68+
6869
session[:locale] ||= cookies[:locale]
6970
if session[:locale]
7071
set_locale = session[:locale]

app/controllers/sessions_controller.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def failure
5555
end
5656

5757
def switch_language
58-
if Settings.multilanuage == true
58+
if Settings.multilanuage != false
5959
session[:locale] = params[:locale].to_sym
6060
cookies.permanent[:locale] = params[:locale].to_sym
6161
_msg = {:notice => t(:language_changed_to, :lang => t(params[:locale].to_sym))}
@@ -72,7 +72,6 @@ def dirty_link_to(body,url)
7272
end
7373

7474
def signed_in_successfully
75-
#redirect_to root_url, :notice => 'OK'
7675
back_url = session[:login_for_request] || root_url
7776
back_url.gsub! /[\A"|"\Z]/,''
7877
redirect_to back_url, :notice => t(:signed_in)

app/views/pages/_banner.haml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
= link_to image_tag(banner.banner.url(:large)), banner.page
22
%div{class: "carousel-caption layout-#{banner.page.banner_text_position || 'right'}"}
3-
%h2=banner.page.banner_title
4-
%p=banner.page.banner_text
3+
- if banner.linked_url != '#'
4+
%h2=link_to banner.linked_url, banner.linked_url, target: :blank
5+
- else
6+
%h2=banner.page.banner_title
7+
%p=banner.page.banner_text

app/views/pages/_page.haml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
%div{:style=> params[:controller]=='home' ? 'min-height: 200px;' : ''}
88
= render 'pages/page_menu', page: page
9-
- if truncated
9+
- if truncated && Settings.supress_page_title != true
1010
%h2= link_to page.title, page
11-
- else
11+
- elsif Settings.supress_page_title != true
1212
%h2=page.title
1313
%article
1414
- present page do |presenter|

app/views/pages/show.haml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- title @page.title
12
- present @page do |presenter|
23
- if @page.banner && @page.banner.banner.exists?
34
.row-fluid
@@ -9,11 +10,13 @@
910
.row-fluid
1011
- if @page
1112
%article
13+
- unless Settings.supress_page_title == true
14+
%h1=presenter.title
1215
= render 'pages_menu'
1316
.content= presenter.body
1417
- else
1518
.alert.alert-error= t(:page_not_found)
1619

17-
- if can_execute?('Admin')
20+
- unless Settings.multilanguage == false
1821
.row-fluid
1922
= render 'translations', page: @page

config/settings/test.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ smtp_default_from: "[email protected]"
1111

1212
application_brand: "WAT-HOME"
1313
application_mail_signature: WAT TEST APPLICATION
14-
application_mail_subject_prefix: "WAT: "
14+
application_mail_subject_prefix: "WAT: "
15+
16+
supress_page_title: false
17+
multilanguage: true

fixtures/avatar.jpg

114 KB
Loading

spec/integration/i18n_spec.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
describe "Internationalization" do
44
it "switches language" do
55
visit root_path
6-
page.should have_content "Sign in"
7-
click_link "Deutsch"
8-
page.should have_content "Anmelden"
9-
click_link "English"
10-
page.should have_content "Sign in"
6+
if Settings.multilanguage == true
7+
page.should have_content "Sign in"
8+
click_link "Deutsch"
9+
page.should have_content "Anmelden"
10+
click_link "English"
11+
page.should have_content "Sign in"
12+
else
13+
visit switch_language_path(:de)
14+
page.should have_content I18n.t(:cannot_change_language)
15+
end
1116
end
1217
end
1318

spec/requests/attachments_controller_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
attach_file("application_file_file", File.join(Rails.root,'fixtures', 'avatar.jpg'))
8181
click_button("Upload file")
8282
page.should have_content 'avatar.jpg'
83-
page.should have_content '3 KB'
83+
page.should have_content '117 KB'
8484
click_link "Delete"
8585
if _path
8686
File.exist?(_path).should be_false

spec/requests/pages_controller_spec.rb

+12-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
_usr.facilities.find_or_create_by( name: 'Admin', access: 'rwx' )
4141
_usr.email_confirmed_at = Time.now
4242
_usr.save!
43-
visit switch_language_path(:en)
43+
visit switch_language_path(:en) if Settings.multilanguage == true
4444
visit page_path(@page)
4545
end
4646

@@ -49,7 +49,11 @@
4949
fill_in "page_body", with: "This is a modified page."
5050

5151
click_button "Save page"
52-
page.should have_content @page.title
52+
if Settings.supress_page_title != true
53+
page.all('article h1', text: @page.title).first.should_not be_nil
54+
else
55+
page.all('article h1', text: @page.title).first.should be_nil
56+
end
5357
page.should have_content "This is a modified page"
5458
end
5559

@@ -65,7 +69,11 @@
6569
fill_in "page_body", with: lorem()
6670
click_button "Save page"
6771
page.should have_content "Page successfully created"
68-
page.should have_content "A new page for WAT"
72+
if Settings.supress_page_title != true
73+
page.all('h1', text: "A new page for WAT").first.should_not be_nil
74+
else
75+
page.all('h1', text: "A new page for WAT").first.should_not be_nil
76+
end
6977
page.should have_content "Lorem ipsum"
7078
end
7179

@@ -83,6 +91,7 @@
8391
end
8492

8593
describe "Translations" do
94+
8695
before(:each) do
8796
visit switch_language_path(:en)
8897
click_link "Create page"

spec/support/wat_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# wat's Spec Helper
22

33
unless defined?(TEXT_FILE_FIXTURE)
4-
TEXT_FILE_FIXTURE = File.expand_path('../../fixtures/testfile.txt', __FILE__)
5-
PICTURE_FILE_FIXTURE= File.expand_path('../../fixtures/avatar.jpg',__FILE__)
4+
TEXT_FILE_FIXTURE = File.expand_path('../../../fixtures/testfile.txt', __FILE__)
5+
PICTURE_FILE_FIXTURE= File.expand_path('../../../fixtures/avatar.jpg',__FILE__)
66

77
# Create a user with Identity and Facilities through database
88
# @param [String] username

0 commit comments

Comments
 (0)