Skip to content

Commit

Permalink
Add rspec for output deprecation warning to non string example descri…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
eisukeyeongjo committed Mar 20, 2024
1 parent 5b0ac09 commit df61af5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/rspec/core/example_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,26 @@ def define_and_run_group(define_outer_example = false)
group = RSpec.describe(Object, "my desc") { }
expect(group.description).to eq(group.metadata[:description])
end

it "does not output deprecation warning when description is a string" do
expect_no_deprecation
RSpec.describe.it('hoge')
end

it "does not output deprecation warning when description is nil" do
expect_no_deprecation
RSpec.describe.it
end

it "outputs deprecation warining when description is a symbol" do
expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /Symbol object `:symbol` as example doc string/)
RSpec.describe.it(:symbol)
end

it "outputs deprication warning when description is a hash" do
expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /Hash object `{"foo"=>"bar"}` as example doc string/)
RSpec.describe.it({ "foo" => "bar" })
end
end

describe '#metadata' do
Expand Down

0 comments on commit df61af5

Please sign in to comment.