Search code examples
ruby-on-railsunit-testingsyntax-errorrubymine

Syntax error while running tests from terminal


I have a rails application on RubyMine. While running tests on terminal(Mac OS X 10.7), I am getting the following error:

Ruby -Itest test/unit/user_test.rb
Creating sqlite :memory: database
-- create_table("logins", {:force=>true})
   -> 0.0014s
-- create_table("posts", {:force=>true})
   -> 0.0094s
-- create_table("users", {:force=>true})
   -> 0.0011s
-- initialize_schema_migrations_table()
   -> 0.0009s
-- assume_migrated_upto_version(20110927003058, ["db/migrate"])
   -> 0.0007s
Loaded suite test/unit/user_test
Started
E

1) Error:
test_the_truth(UserTest):
SyntaxError: (erb):23: syntax error, unexpected keyword_end, expecting $end
;  end ; _erbout.concat "\n"
      ^


Finished in 0.024246 seconds.

1 tests, 0 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0% passed

41.24 tests/s, 0.00 assertions/s

I am guessing these lines are creating the issue:

<td><%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %></td>

Is that so? If Yes, why?

Edited:

<h1>Listing users</h1>

<table>
  <tr>
    <th>Unity id</th>
    <th>Name</th>
    <th>Password</th>
    <th>Role</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @users.each do |user| %>
  <tr>
    <td><%= user.Unity_ID %></td>
    <td><%= user.Name %></td>
    <td><%= user.Password %></td>
    <td><%= user.Role %></td>
    <td><%= link_to 'Show', user %></td>
    <td><%= link_to 'Edit', edit_user_path(user) %></td>
    <td><%= link_to "Destroy", user, :confirm => "Are you sure?", :method => :delete %> </td> --- Line 23
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New User', new_user_path %>

Thanks!


Solution

  • It was a configuration issue. Created a new project, copied my files. Now its working.