5
votes

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
4
Please show the code of that page.. - Kashiftufail
If you indented your code properly, you'd be more likely to detect such errors yourself. - Andrew Grimm

4 Answers

8
votes

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

7
votes

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)

3
votes

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

0
votes

This happened to me as well but because I was missing an end. I am following this tutorial

http://tutorials.jumpstartlab.com/projects/blogger.html

My model was:

class ArticlesController < ApplicationController
    def index
     @articles = Article.all
    end

It needed to be:

class ArticlesController < ApplicationController
    def index
     @articles = Article.all
    end 
end

Hope that helps someone.