2

私はキュウリとrspecを初めて使用し、テキストが「Regístrate」であるボタンをテストしようとしています(アクセント「í」を見てください)。

私のアプリには、スペイン語で書かれた多くのコントロールがあり、アクセントはáéíóúです。しかし、アクセントのあるこれらの母音のためにエラーが発生します。簡単な解決策があると確信していますが、解決策を見つけることはできません。

テストの説明を変更することはできますが、ユーザーアプリケーションの単語を変更することはできません...何か提案はありますか?

describe "signup" do

  before { visit signup_path }

  let(:submit) { "Regístrate" }

  describe "con información válida" do
    it "no debería crear el usuario" do
      expect { click_button submit }.not_to change(User, :count)
    end
  end

  describe "con información válida" do
    before do
      fill_in "Nombre",         with: "Example User"
      fill_in "Email",        with: "user@example.com"
      fill_in "Password",     with: "foobar"
      fill_in "Confirmación", with: "foobar"
    end

    it "debería crear el usuario" do
      expect { click_button submit }.to change(User, :count).by(1)
    end
  end
end

エラー:

user_signup_steps.rb:3: syntax error, unexpected $end, expecting keyword_end
"Regístrate"
   ^ (SyntaxError)
4

1 に答える 1

3

エンコードエラーのようです。次の行をスペック ファイルの先頭に追加してみてください。

# encoding: utf-8
于 2012-11-29T09:23:36.337 に答える