Sha256: 98b48ec1f29df33cf4251d0dc5945697ff6ab3a85403e27f9044332270f6ba25

Contents?: true

Size: 946 Bytes

Versions: 6

Compression:

Stored size: 946 Bytes

Contents

describe :script do

  it "raises Invalid_Relative_HREF if :src is not relative" do
    should.raise(Escape_Escape_Escape::Invalid_Relative_HREF) {
      actual do
        script.src('http://www.example.org/file.js')./
      end
    }.message.should.match /example\.org/
  end

  it "allows a relative :src" do
    target %^<script src="&#47;file.js"></script>^
    actual {
      script.src('/file.js')./
    }
  end

  it "escapes slashes in attr :src" do
    target %^<script src="&#47;dir&#47;file.js"></script>^
    actual {
      script.src('/dir/file.js')./
    }
  end

  it "does not allow vars in :script :src attribute" do
    target :body, <<-EOF
      <script src="help"></script>
    EOF

    actual do
      script.src(:help)
    end
  end

  it "ignores text for :script block" do
    target %^<script src="&#47;hello.js"></script>^
    actual {
      script.src('/hello.js') { 'hello' }
    }
  end


end # === describe :JS ===

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
www_app-1.3.0 specs/server-side/0021-script.rb
www_app-1.2.1 specs/server-side/0021-script.rb
www_app-1.2.0 specs/server-side/0021-script.rb
www_app-1.1.0 specs/server-side/0021-script.rb
www_app-1.0.1 specs/as_ruby/0021-script.rb
www_app-1.0.0 specs/as_ruby/0021-script.rb