How do I get the HTML in an element using Capybara? - Stack Overflow

> find(".tweet-img").find('img')
=> #<Capybara::Node::Element tag="img" path="/html/body/ ... /img">
> find(".tweet-img").native
=> 
#(Element:0x6090 {
  name = "div",
  attributes = [ #(Attr:0x60a4 { name = "class", value = "tweet-img" })],
  children = [
    #(Text "\n          "),
    #(Element:0x60b8 {
      name = "img",
      attributes = [
        #(Attr:0x60cc { name = "class", value = "rounded img-responsive" }),
        #(Attr:0x60e0 {
          name = "src", ... /image.png"
          })]
      }),

file fixture - RSpec Rails - Relish

a file named “spec/fixtures/files/sample.txt”

Hello

a file named “spec/lib/file_spec.rb” with:

require "rails_helper"

RSpec.describe "file" do
  it "reads sample file" do
    expect(file_fixture("sample.txt").read).to eq("Hello")
  end
end

See also