Sha256: 29f43b29427ce4f4d37199c03e1bea18cc3b3fd8ec030268eedf75f7928312cf

Contents?: true

Size: 617 Bytes

Versions: 5

Compression:

Stored size: 617 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
      regex.match("<body></body>").to_s.should eq('<body>')
      regex.match("<body><h1></h1></body>").to_s.should eq('<body>')
      regex.match("<body attribute='something'><h1></h1></body>").to_s.should eq("<body attribute='something'>")
    end

    it 'responds false when no head tag' do
      regex.match("<html></html>").should be_false
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-env-notifier-0.0.5 spec/rack/body_injector_spec.rb
rack-env-notifier-0.0.4 spec/rack/body_injector_spec.rb
rack-env-notifier-0.0.3 spec/rack/body_injector_spec.rb
rack-env-notifier-0.0.2 spec/rack/body_injector_spec.rb
rack-env-notifier-0.0.1 spec/rack/body_injector_spec.rb