The code
welcomes_spec.rb:
...
describe "GET /welcomes" do
it "Should render main page" do
visit root_path
page.should have_content(t("popular_photos"))
end
end
...
ru.yml
...开发者_Go百科
ru:
hello: "Hello world"
default_page_title: "Test_page_title"
main_page: "Главная"
popular_photos: !NON ASCII SYMBOLS HERE!
after $rake spec
leads the error:
Failure/Error: page.should have_content(t("popular_photos"))
NoMethodError:
undefined method `t' for #<RSpec::Core::ExampleGroup::Nested_5::Nested_1:0xba77028>
I am newbie and don't know how to fix it.
Simply replace:
page.should have_content(t("popular_photos"))
with:
page.should have_content(I18n.translate("popular_photos"))
精彩评论