Sha256: c5cf28baf636e9cd622b2cc534f9f702e939c4eab8397cabe56148b201f14dcb
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true require 'rails_helper' RSpec.describe GraphTypes::MoneyType, '.formatted' do let!(:value) { 1000 } let!(:field) { described_class.fields['formatted'] } specify { expect(field.type.to_s).to eq 'String' } describe ':delimiter' do let(:argument) { field.arguments['delimiter'] } specify { expect(argument.type.to_s).to eq 'String' } specify { expect(argument.default_value).to eq '.' } describe '.resolve' do subject { field.resolve value, { delimiter: '*' }, nil } specify { expect(subject).to eq '$1*000.00' } end end describe ':separator' do let(:argument) { field.arguments['separator'] } specify { expect(argument.type.to_s).to eq 'String' } specify { expect(argument.default_value).to eq ',' } describe '.resolve' do subject { field.resolve value, { separator: '*' }, nil } specify { expect(subject).to eq '$1,000*00' } end end describe ':unit' do let(:argument) { field.arguments['unit'] } specify { expect(argument.type.to_s).to eq 'String' } specify { expect(argument.default_value).to eq 'R$ ' } describe '.resolve' do subject { field.resolve value, { unit: '*' }, nil } specify { expect(subject).to eq '*1,000.00' } end end context 'when all arguments is given' do describe '.resolve' do subject do field.resolve value, { delimiter: '!', separator: '@', unit: '*' }, nil end specify { expect(subject).to eq '*1!000@00' } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graph_types-0.2.0 | spec/lib/graph_types/types/money_type_spec.rb |
graph_types-0.1.0 | spec/lib/graph_types/money_type_spec.rb |