/usr/share/doc/ruby-rspec-core/features/command_line/rake_task.feature is in ruby-rspec-core 3.7.0c1e0m0s1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | Feature: rake task
RSpec ships with a rake task with a number of useful options.
We recommend you wrap this in a `rescue` clause so that you can
use your `Rakefile` in an environment where RSpec is unavailable
(for example on a production server). e.g:
```ruby
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
end
```
Scenario: Default options with passing spec (prints command and exit status is 0)
Given a file named "Rakefile" with:
"""ruby
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
rescue LoadError
# no rspec available
end
"""
And a file named "spec/thing_spec.rb" with:
"""ruby
RSpec.describe "something" do
it "does something" do
# pass
end
end
"""
When I run `rake`
Then the output should match:
"""
(ruby|rbx) -I\S+ [\/\S]+\/exe\/rspec
"""
Then the exit status should be 0
Scenario: Default options with failing spec (exit status is 1)
Given a file named "Rakefile" with:
"""ruby
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
rescue LoadError
# no rspec available
end
"""
And a file named "spec/thing_spec.rb" with:
"""ruby
RSpec.describe "something" do
it "does something" do
fail
end
end
"""
When I run `rake`
Then the exit status should be 1
Scenario: Setting `fail_on_error = false` with failing spec (exit status is 0)
Given a file named "Rakefile" with:
"""ruby
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.fail_on_error = false
end
task :default => :spec
rescue LoadError
# no rspec available
end
"""
And a file named "spec/thing_spec.rb" with:
"""ruby
RSpec.describe "something" do
it "does something" do
fail
end
end
"""
When I run `rake`
Then the exit status should be 0
Scenario: Passing arguments to the `rspec` command using `rspec_opts`
Given a file named "Rakefile" with:
"""ruby
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--tag fast"
end
rescue LoadError
# no rspec available
end
"""
And a file named "spec/thing_spec.rb" with:
"""ruby
RSpec.describe "something" do
it "has a tag", :fast => true do
# pass
end
it "does not have a tag" do
fail
end
end
"""
When I run `rake spec`
Then the exit status should be 0
Then the output should match:
"""
(ruby|rbx) -I\S+ [\/\S]+\/exe\/rspec --pattern spec[\/\\*{,}]+_spec.rb --tag fast
"""
Scenario: Passing rake task arguments to the `rspec` command via `rspec_opts`
Given a file named "Rakefile" with:
"""ruby
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec, :tag) do |t, task_args|
t.rspec_opts = "--tag #{task_args[:tag]}"
end
rescue LoadError
# no rspec available
end
"""
And a file named "spec/thing_spec.rb" with:
"""ruby
RSpec.describe "something" do
it "has a tag", :fast => true do
# pass
end
it "does not have a tag" do
fail
end
end
"""
When I run `rake spec[fast]`
Then the exit status should be 0
Then the output should match:
"""
(ruby|rbx) -I\S+ [\/\S]+\/exe\/rspec --pattern spec[\/\\*{,}]+_spec.rb --tag fast
"""
|