Skip to content

Commit

Permalink
capture tests within begin/ensure
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattades committed May 15, 2024
1 parent e4e7121 commit ac5ee7d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/cyperful/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def steps_per_test
end

children.each { |child| find_test_steps(child, out, depth) }
elsif ast.type == :begin
elsif ast.type == :begin || ast.type == :kwbegin || ast.type == :ensure
ast.children.each { |child| find_test_steps(child, out, depth) }
end

Expand Down
25 changes: 25 additions & 0 deletions test/dummy/spec/system/nesting_system_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require "rails_helper"

describe "nesting", type: :system do
context "some context" do
it "can visit root" do
visit root_path

expect(page).to have_text("Hello, World!")

begin
expect(page).to have_text("Hello")
ensure
expect(page).to have_text("Hello,")
end

within "h1" do
expect(page).to have_text("Hello, W")
end
end
end

it "foo bar" do
visit root_path
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "alt init", type: :system do
RSpec.describe "prefixed with RSpec.", type: :system do
it "can visit root" do
visit root_path

Expand Down

0 comments on commit ac5ee7d

Please sign in to comment.