开发者

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</开发者_C百科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!


Usually when I get that error (warning: anecdotal), it's because I've missed the do keyword after an iterator, or a haml function that takes a block in a view.

I don't see anything wrong with the link_to line - can you post the source of the file that contains the error (and point out which line is line 23)?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜