【发布时间】:2011-07-31 21:20:27
【问题描述】:
我正在尝试传递这个简单的断言
assert_select '.price', /\€[,\d]+\.\d\d/
在视图中 .price 类的代码是
<span class="price">
<%= number_to_currency(product.price, options = {:format => "%u%n", :unit => "€"}) %> </span>
当我使用默认的<%= number_to_currency(product.price) %> 时,一切都很好。当我切换到欧元时,它就不起作用了。
这是错误信息:
/Users/noapologize/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require': /Users/noapologize/rails_projects/depot/test/functional/store_controller_test.rb:11: invalid multibyte char (UTF-8) (SyntaxError)
/Users/noapologize/rails_projects/depot/test/functional/store_controller_test.rb:11: invalid multibyte char (UTF-8)
/Users/noapologize/rails_projects/depot/test/functional/store_controller_test.rb:11: syntax error, unexpected $end, expecting keyword_end
assert_select '.price', /\€[,\d]+\.\d\d/
我想我写这个 assert_select 的方式是错误的。有人可以启发我吗?
感谢您的宝贵时间。
【问题讨论】:
标签: utf-8 ruby-on-rails-3.1 ruby-1.9