mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 19:04:29 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
18 lines
601 B
Ruby
18 lines
601 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe 'Oj' do
|
|
it "is enabled" do
|
|
classes = Set.new
|
|
tracer = TracePoint.new(:c_call) { |tp| classes << tp.defined_class }
|
|
tracer.enable { ActiveModel::ArraySerializer.new([1, 2, 3]).to_json }
|
|
|
|
expect(classes).to include(Oj::Rails::Encoder)
|
|
end
|
|
|
|
it "escapes HTML entities the same as ActiveSupport" do
|
|
expect("<b>hello</b>".to_json).to eq("\"\\u003cb\\u003ehello\\u003c/b\\u003e\"")
|
|
expect('"hello world"'.to_json). to eq('"\"hello world\""')
|
|
expect("\u2028\u2029><&".to_json).to eq('"\u2028\u2029\u003e\u003c\u0026"')
|
|
end
|
|
end
|