-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathoperation_sanitizer_spec.rb
More file actions
35 lines (26 loc) · 1016 Bytes
/
operation_sanitizer_spec.rb
File metadata and controls
35 lines (26 loc) · 1016 Bytes
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
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe GraphqlDevise::MountMethod::OperationSanitizer do
describe '.call' do
subject { described_class.call(default: default, only: only, skipped: skipped) }
let(:op_class1) { Class.new }
let(:op_class2) { Class.new }
let(:op_class3) { Class.new }
context 'when the operations passed are mutations' do
let(:skipped) { [] }
let(:only) { [] }
let(:default) { { operation1: { klass: op_class1 }, operation2: { klass: op_class2 } } }
context 'when no other option besides default is passed' do
it { is_expected.to eq(default) }
end
context 'when there are only operations' do
let(:only) { [:operation1] }
it { is_expected.to eq(operation1: { klass: op_class1 }) }
end
context 'when there are skipped operations' do
let(:skipped) { [:operation2] }
it { is_expected.to eq(operation1: { klass: op_class1 }) }
end
end
end
end