user663896
user663896

Reputation:

Rails | How to create a non-ASCII spec?

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

...
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.

Upvotes: 1

Views: 214

Answers (1)

apneadiving
apneadiving

Reputation: 115521

Simply replace:

page.should have_content(t("popular_photos"))

with:

page.should have_content(I18n.translate("popular_photos"))

Upvotes: 2

Related Questions