Sha256: def063e8777104971d9bc71bcfb3b7f6ffa2f0f5fe7ded5796959c1e51889d47

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

require 'spec_helper'

describe Rack::EnvNotifier::BodyInjector do
  describe 'body tag regex' do
    let(:regex) { described_class::BODY_TAG_REGEX }
    subject { regex }

    it { should be_kind_of(Regexp) }

    it 'only picks a valid <body> tag' do
      expect(regex.match("<body></body>").to_s).to eq('<body>')
      expect(regex.match("<body><h1></h1></body>").to_s).to eq('<body>')
      expect(regex.match("<body attribute='something'><h1></h1></body>").to_s).to eq("<body attribute='something'>")
    end

    it 'responds nil when no head tag' do
      expect(regex.match("<html></html>")).to eq nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-env-notifier-0.0.6 spec/rack/body_injector_spec.rb