我正在关注 railstutorial.org 教程。虽然我能够在网页上看到 gravatar,但我的 rspec 测试失败了。
这是 user_controller_spec.rb 测试:
describe "GET 'show'" do
before(:each) do
@user = Factory(:user)
end
it "should be successful" do
get :show, :id => @user
response.should be_success
end
end
这是相关的 show.html.erb 文件:
<table class="profile" summary="Profile information">
<tr>
<td class="main">
<h1>
<%= gravatar_image_tag(@user.email) %>
<%= @user.name %>
</h1>
</td>
<td class="sidebar round">
<strong>Name</strong> <%= @user.name %><br />
<strong>URL</strong> <%= link_to user_path(@user), @user %>
</td>
</tr>
</table>
我收到一条错误消息,指出“未定义的方法'gravatar_image_tag'。我已经通过执行“gem install gravatar_image_tag”安装了相应的gem,将其添加到我的gemfile,并且还执行了“bundle install”。当我执行“gem”时它被列为已安装列表”
我已经尝试调试了几个小时了。任何帮助,将不胜感激。提前致谢。顺便说一句,我正在运行带有 GIT Bash、RubyInstaller-1.9.2-p0 的 32 位 Windows 7。
错误信息: