Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

syntax error, unexpected $end, expecting keyword_end

I am getting this error when trying to click a button with umlaut:

syntax error, unexpected $end, expecting keyword_end
                click_on 'Neue Firma hinzufц╪gen'

I am testing with Ruby & Capabara.

##Create_User_spec.rb 
require 'acceptance/acceptance_helper' 
## Feature 'Create User' 
feature 'Create User' do ## 
Scenario 'Create a User' 
scenario 'Create a User' do 
  ## Login into the service 
  visit 'url' 
  fill_in 'User-username', :with => 'test' 
  fill_in 'User-password', :with => 'test' 
  click_on 'login' 
  click_link 'Test' 
  click_on 'Neue Firma hinzufügen' 
end 
end
like image 341
mancho1981 Avatar asked Mar 28 '12 10:03

mancho1981


3 Answers

This also can happen if you have a stray . trailing a method, so check for those as well.

like image 137
Ben Phelps Avatar answered Nov 11 '22 16:11

Ben Phelps


It happened to me because of special characters, in my case portuguese signs. I believe the problem is the "ü" in hinzufügen. Looking for a solution yet.

Edit: found a solution!

I added the following to the very top of the rb file:

# encoding: utf-8

(don't miss the # sign, it is needed)

like image 26
Fabio CR Avatar answered Nov 11 '22 17:11

Fabio CR


This error due to an extra end.Mean you have written an extra end with no matching do.

like image 3
Kashiftufail Avatar answered Nov 11 '22 16:11

Kashiftufail