Comments (9)
Running rspec with specific path like rspec spec/controllers/my_spec.rb
works as well, for the same exact file that should be filtered with "my string"
.
from spring-commands-rspec.
Looks like it's working if you pass spec directory explicitly like rspec -e "my string" spec/
. Not sure why this has to be explicit, especially in rails.
from spring-commands-rspec.
This is probably the same issue: #7
from spring-commands-rspec.
This issue is caused because when run through spring
, the $0
/ $PROGRAM_NAME
deviate from RSpec's expectations. Here is the output for this global when run via different methods:
- Via bundler:
~/.rvm/gems/ruby-2.1.2@myapp/bin/rspec
- Via bundler binstub:
bin/rspec
- Via rake:
~/.rvm/gems/ruby-2.1.2@myapp/gems/rspec-core-3.0.3/exe/rspec
- Via spring:
rspec
However, when you add args, say --require spec_helper
this is what I get:
- Via bundler:
~/.rvm/gems/ruby-2.1.2@myapp/bin/rspec
- Via bundler binstub:
bin/rspec
- Via spring:
rspec --require spec_helper
Note that rake
treats CLI different, and does not directly allow passing the CLI args to RSpec. thus it has been removed from the above list.
RSpec checks $0
here to determine if it should add "spec"
as a path here:
# lib/rspec/core/configuration.rb
def files_or_directories_to_run=(*files)
files = files.flatten
files << default_path if (command == 'rspec' || Runner.running_in_drb?) && default_path && files.empty?
@files_or_directories_to_run = files
@files_to_run = nil
end
def command
$0.split(File::SEPARATOR).last
end
from spring-commands-rspec.
The simple workaround is to shim the file name into the binstub: $0 = __FILE__
. Obviously this isn't a good long term or permanent solution. Per this commit in spring core this process title should most likely just be name
. I'm not sure about the history why it is all of the args too, so I'm not comfortable making a fix there.
from spring-commands-rspec.
Same problem here.
from spring-commands-rspec.
Spring sets $0
here:
https://github.com/rails/spring/blob/master/lib/spring/application.rb#L161
It gets the value from here:
https://github.com/rails/spring/blob/master/lib/spring/command_wrapper.rb#L44-L46
So I think the implementation of that method is wrong, basically.
from spring-commands-rspec.
I just submitted a PR for Spring: rails/spring#369
from spring-commands-rspec.
Jon merged the PR, so this should be in the next Spring release.
from spring-commands-rspec.
Related Issues (20)
- Doesn't recognize `rspec` HOT 3
- rspec does not find any examples HOT 1
- shoulda-matchers not included (Rails 4.1) HOT 3
- Doesn't work when not in the Gemfile HOT 2
- binstub doesn't seem to be working HOT 16
- Load time incorrect with Spring HOT 17
- can't get --example or file:123 to works HOT 1
- using format (-f) option creates duplicate output HOT 2
- key not found "rspec" HOT 8
- RSpec with bin/spring broken after upgrading and rolling back from RSpec 3.1 HOT 1
- Maintain a changelog
- Not passing environment variables HOT 1
- spring-commands-rspec don't work HOT 8
- Spring is not using the bundled version of Rspec
- using initialiser class causes problem after first few rspec call HOT 1
- RSpec not loading its binstub HOT 6
- Is this still alive?
- FYI: On Rails 7 & Ruby 3, $ rails console occurs an error HOT 2
- `spring rspec` doesn't respect rspec's default file matching pattern HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-commands-rspec.