-
-
Notifications
You must be signed in to change notification settings - Fork 1k
-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec with 'feature' or 'features' in directory name are ignored #1387
Comments
No other users have reported this problem, which makes me think there's something specific in your project interfering. Can you publish your repo (or a highly edited, stripped down version of it) so we can clone it and run it locally? |
Alternately, if you're able to come up with a more isolated repro case, that would be wonderful. |
I have several apps using feature specs. In each those specs are correctly run. rspec-rails does not do anything special with the RSpec does load configuration options from: As a troubleshooting step, you can try outputting the current pattern in your spec setup: RSpec.configure do |c|
puts "Current pattern: #{c.pattern}"
end |
There is a bug here, |
(I have a reproducible example if you want it @cupakromer) |
@JonRowe sure please log it, that sounds like a different issue though from what @tompesman is reporting. Does what you found affect all types? |
While trying to isolate the problem I was doing puts 'test'
raise 'test' and ran my tests with So it will run the test, but the output to the console is muted. |
@cupakromer the current pattern is: |
@tompesman it would be very helpful if you were able to share a reproducible example / project. From the sounds of it, the spec is being run, the issue seems to be output. Based on the pattern you shared I see no immediate reason why it would prevent the spec from running or changing output. Something else that can affect which specs are run are filters. Would it be possible for you to share the complete output of the different commands you are running? Or better still provide a reproducible project? |
Got it! I've some specs that verify rake tasks. Not very pretty, but it gets the job done. Is there a better and faster way to test rake tasks? spec/lib/tasks/notification_spec.rb require 'spec_helper'
describe 'notification' do
include_context 'rake'
its(:prerequisites) { should include('environment') }
it 'sends notifications to users' do
subject.invoke
end
end spec/support/shared_contexts/rake.rb require 'rake'
shared_context 'rake' do
let(:rake) { Rake::Application.new }
let(:task_name) { self.class.top_level_description }
let(:task_path) { "lib/tasks/#{task_name.gsub(':', '_')}" }
subject { rake[task_name] }
def loaded_files_excluding_current_rake_file
$LOADED_FEATURES.reject { |file| file == Rails.root.join("#{task_path}.rake").to_s }
end
before do
Rake.application = rake
Rake.application.rake_require(task_path, [Rails.root.to_s], loaded_files_excluding_current_rake_file)
Rake::Task.define_task(:environment)
end
end |
I am seeing the same thing ( I will update back here if I figure out a solution / reason |
Update: I am trying to update my Rakefile (https://github.com/18F/dolores-landingham-bot/blob/master/Rakefile) to include a pattern for rspec This pattern:
Runs all of the specs in the features directory. This pattern:
Runs all of the specs in my spec directory except for the This pattern:
Runs all of my model and request specs. This pattern:
Runs my model and feature specs. BUT this pattern:
Runs all of the specs in my spec directory except for the In conclusion: using the |
Ok I was wrong. Here is how I was testing to see if my feature specs were running or not: when I ran them in isolation, they failed because there was a helper method they were using that was not being included properly. When I ran the whole suite, there were no failing specs, I am guessing because the helper method was being loaded for a request spec that was also being run. I realized my error when I copied one of my feature specs into another file to test if it was a naming issue. When I ran In conclusion: I am not able to reproduce this bug. I am wondering how others who experienced this are confirming that feature specs are not running. If they are confirming by looking for a failure count, they may be experiencing something similar to what I was seeing. |
If you run rspec with |
@samphippen Went through the comments thoroughly and there isn't a reproducable case. I noticed your adding the 'needs reproduction case' tag to some Hacktorbest issues and am asking that this issue can have that tag added as well. |
Closing as stale. |
Looking back its likely this was a pattern issue. |
Specs in directories with the name 'feature' or 'features' are ignored when I run:
bundle exec rspec
But if I add a pattern the specs are executed:
bundle exec rspec --pattern 'spec/**/feature/*_spec.rb,spec/**/features/*_spec.rb'
When I combine it with the other specs the specs in the feature/features directory are ignored:
bundle exec rspec --pattern 'spec/**/feature/*_spec.rb,spec/**/features/*_spec.rb,spec/**/*_spec.rb'
I understand that the directory name feature has a special function, but these directories are not at the root of the spec directory. Like:
spec/services/feature/*_spec.rb
I've reported this at
rspec-core
and we've come to the conclusion that is it related torspec-rails
: rspec/rspec-core#1982What can I do to get the specs executed all at once?
The text was updated successfully, but these errors were encountered: