Skip to content

Commit f819db1

Browse files
committed
Add basic test for AppFileRun component
1 parent 0e23fb3 commit f819db1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require "rails_helper"
2+
3+
RSpec.describe CodeBlock::AppFileRun, type: :view do
4+
def render_page(*, **)
5+
Capybara.string(render(*, **))
6+
end
7+
8+
before do
9+
allow(view).to receive(:headers).and_return({"Content-Type" => "text/html"})
10+
end
11+
12+
it "renders contents of file" do
13+
page = render_page(CodeBlock::AppFileRun.new("spec/fixtures/code_block/app_file/example.rb"))
14+
expect(page).to have_content(<<~RUBY.strip)
15+
class FixturesCodeBlockAppFileExample
16+
def add(m, n)
17+
m + n
18+
end
19+
end
20+
RUBY
21+
expect(page).to have_content("spec/fixtures/code_block/app_file/example.rb")
22+
end
23+
end

0 commit comments

Comments
 (0)