user2462805
user2462805

Reputation: 1079

Sublime Text 3 and Rspec, building error

I just have installed Sublime Text 3 and few packages with it.

I'm doing some Ruby stuff and currently want to build my program inside Sublime Text.

But when I hit Cmb + b in order to build it, I've got few errors in Sublime Text console :

> [Errno 2] No such file or directory: 'rspec'
[cmd: ['rspec', '-I /Applications/MAMP/htdocs/Dropbox/pragmatic-ruby', '/Applications/MAMP/htdocs/Dropbox/pragmatic-ruby/studio_game.rb']]
[dir: /Applications/MAMP/htdocs/Dropbox/pragmatic-ruby]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

Sometimes I also get :

Could not find 'rspec-core' (>= 0) among 39 total gem(s) (Gem::LoadError)

Upvotes: 4

Views: 1974

Answers (4)

heartless
heartless

Reputation: 11

Was also my problem. I just set the Build System to Ruby and my code works now.

Tools > Build System > Ruby

Upvotes: 0

Fer Martin
Fer Martin

Reputation: 1540

Source: https://github.com/SublimeText/RSpec/issues/50#issuecomment-64077090

Since the build command itself is just a configuration that is used by Sublime directly, I can't think of a way to dynamically do it.

One easy way to work around it is to copy the build file and paste it as [Sublime]/Packages/User/RSpec/RSpec.sublime-build and modify it to meet your needs.

Hope this helps!

Upvotes: 0

engineersmnky
engineersmnky

Reputation: 29488

Rspec Package includes its own build system

{
    "cmd": ["rspec", "-I ${file_path}", "$file"],
    "file_regex": "# ([A-Za-z:0-9_./ ]+rb):([0-9]+)",
    "working_dir": "${project_path:${folder:${file_path}}}",
    "selector": "source.ruby",

    "windows":
    {
            "cmd": ["rspec.bat", "-I ${file_path}", "$file"]
    }
}

If your Tools->BuildSystem is set to automatic maybe try and just use Ruby. I am not exactly sure how BuildSystem

Upvotes: 0

Bibhas Debnath
Bibhas Debnath

Reputation: 14939

It seems it can't find the rspec command. Try installing rspec from your terminal -

gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
gem install rspec-core # for rspec-core only

Upvotes: 1

Related Questions