Why doesn't jasmine work in any of my specifications?

I added gem 'jasmine', '~> 2.0.0'to my Gemfile( group :development, :test) and started the generator rails g jasmine:install.

I have one simple spec :

# spec/javascripts/truth_spec.js 
describe("Truth", function() {
  it("herps the derps", function() {
    expect(true).toEqual(true);
  });
});

When I run rake jasmine, I get the supposedly normal output:

your server is running here: http://localhost:8888/
your tests are here:         /Users/jared/git/givegab/spec/javascripts
your source files are here:  /Users/jared/git/givegab

>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:8888, CTRL+C to stop

I open http://localhost:8888/in my browser and I get a blank gray screen . My JS console is empty, there are no errors, and when I trace the execution using the debugger , I can go through boot.js and jasmine.js. Errors do not occur.

I can set the debugger breakpoint at truth_spec.js, and it never hits.

This is my first time using jasmine, so please assume I'm missing something obvious .

+4
3

. window.onload. , ( S.O.) ​​ . , , .

gem ragaskar , .

0

, http://localhost:8888/jasmine .

:

http://localhost:8888/jasmine?spec=herps the derps

+3

, config/initializers/, jasminerice.rb, , -:

# Use this file to set configuration options for Jasminerice, all of these are initialized to their respective defaults,
# but you can change them here.
if defined?(Jasminerice) == 'constant'
  Jasminerice.setup do |config|
    # Tell Jasminerice to automatically mount itself in your application. If set to false, you must manually mount the
    # engine in order to use Jasminerice.
    #config.mount = true

    # If automatically mounting Jasminerice, specify the location that it should be mounted at.  Defaults to /jasmine, so
    # you could access your tests at http://YOUR_SERVER_URL/jasmine
    #config.mount_at = '/jasmine'

    # Specify a path where your fixutures can be found. Defaults to 'spec/javascripts/fixtures'
    #config.fixture_path = 'spec/javascripts/fixtures'
  end
end

Be sure to restart the rail server. This initializer sets runtime routes for the jasmine web view, so if you run rake routes | grep jasmine, you will see the following:

jasminerice /jasmine Jasminerice::Engine GET /spec/:spec_id/fixtures/*filename(.:format) jasminerice/spec#fixtures spec_index GET /spec(.:format) jasminerice/spec#index GET /fixtures/*filename(.:format) jasminerice/spec#fixtures GET /(:suite)(.:format) jasminerice/spec#index

0
source

Source: https://habr.com/ru/post/1525984/


All Articles