# encoding: utf-8
require_relative 'spec_helper'
describe HelpersController, type: :controller do
render_views
describe 'flying_quotes' do
it 'accepts blocks' do
get :flying_quotes
response.should be_success
response.body.should == '' +
'«text»'
end
end
describe 'russian_typograph' do
it 'accepts blocks' do
get :russian_typograph
response.should be_success
response.body.should == '«<ф>»'
end
end
describe 'typograph_by_locale' do
after do
I18n.locale = :en
end
it 'accepts blocks' do
get :typograph_by_locale
response.should be_success
response.body.should == '“a”'
end
it 'returns origin blocks on unknown locale' do
I18n.locale = :fr
get :typograph_by_locale
response.should be_success
response.body.should == '"a"'
end
end
describe 'head_tag' do
before do
@env = Rails.env
end
after do
Rails.env = @env
end
it 'generates head tag content' do
get :head
response.should be_success
response.body.should == '
' +
'1'
end
it 'adds statistics in production' do
Rails.env = ActiveSupport::StringInquirer.new('production')
get :head
response.should be_success
response.body.should == '' +
"1stat\n"
end
it 'ignores statistics on demand' do
Rails.env = ActiveSupport::StringInquirer.new('production')
get :unstat
response.should be_success
response.body.should == '' +
'2'
end
end
describe 'standard_assets' do
it 'includes links' do
Rails.env = ActiveSupport::StringInquirer.new('development')
get :standard_assets
response.should be_success
response.body.should ==
'' +
'' +
''
end
it 'includes CDN jQuery' do
Rails.env = ActiveSupport::StringInquirer.new('production')
get :standard_assets
response.should be_success
response.body.should ==
'' +
'' +
"" +
''
end
it 'includes additional libraries' do
Rails.env = ActiveSupport::StringInquirer.new('development')
get :library
response.should be_success
response.body.should ==
'' +
'' +
'' +
''
end
end
describe 'tel' do
it 'renders telephone link' do
get :tel
response.should be_success
response.body.should == '+5 55'
end
end
end