2

gem "jasmine"まず、この行をgemファイルに追加し、この2つのコマンドを実行します

  • bundle
  • rails generate jasmine:install

その仕事はうまくいきます。私の問題は何ですか、私のtesting.jsファイルはジャスミンファイルに追加されません。

describe("Hello world", function() {
  it("says hello", function() {
    expect(helloWorld()).toEqual("Hello world!");
  });
});

その私のコード、および public/javascript/testing.js にある私の .js ファイル

function helloWorld() {
  return "Hello world!";
}

エラーメッセージは

ReferenceError: helloWorld が定義されていませんhttp://localhost:8888/__spec__/tesfing_spec.js(4 行目)

jasmine.yml ファイルにパスを追加しました

src_files:
  - "public/javascript/testing.js"

機能していなくても。回答ありがとうございます。

4

0 に答える 0