blob: b9dfabb1b23fb8ec97cf1d3e3e75dc56b37908f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# frozen_string_literal: true
require "spec_helper"
RSpec.describe JsonHelper do
let(:hash) { { "foo" => "bar" } }
let(:json) { '{"foo":"bar"}' }
describe ".json_generate" do
subject { helper.json_generate(hash) }
it "generates JSON" do
expect(subject).to eq(json)
end
it "calls the Gitlab::Json class" do
expect(Gitlab::Json).to receive(:generate).with(hash)
subject
end
end
describe ".json_parse" do
subject { helper.json_parse(json) }
it "parses JSON" do
expect(subject).to eq(hash)
end
it "calls the Gitlab::Json class" do
expect(Gitlab::Json).to receive(:parse).with(json)
subject
end
end
end
|