diff --git a/spec/casserver_spec.rb b/spec/casserver_spec.rb index cb0a42f..edb05c4 100644 --- a/spec/casserver_spec.rb +++ b/spec/casserver_spec.rb @@ -65,6 +65,17 @@ describe 'CASServer' do page.should have_xpath('//input[@id="service"]', :value => @target_service) end + it "uses appropriate localization when 'lang' prameter is given" do + visit "/login?lang=pl" + page.should have_content("Użytkownik") + + visit "/login?lang=pt_BR" + page.should have_content("Usuário") + + visit "/login?lang=en" + page.should have_content("Username") + end + end # describe '/login' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 95da156..cb7d1cc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,8 +12,11 @@ set :run, false set :raise_errors, true set :logging, false -# Avoid potential weirdness by changing the working directory to the CASServer root -FileUtils.cd('..') + +if Dir.getwd =~ /\/spec$/ + # Avoid potential weirdness by changing the working directory to the CASServer root + FileUtils.cd('..') +end def silence_warnings old_verbose, $VERBOSE = $VERBOSE, nil diff --git a/tasks/spec.rake b/tasks/spec.rake new file mode 100644 index 0000000..235b565 --- /dev/null +++ b/tasks/spec.rake @@ -0,0 +1,6 @@ + +require 'spec/rake/spectask' +desc 'Run RSpecs to confirm that all functionality is working as expected' +Spec::Rake::SpecTask.new('spec') do |t| + t.spec_files = FileList['spec/**/*_spec.rb'] +end