spec/unit/yaks/mapper/control/field_spec.rb in yaks-0.7.5 vs spec/unit/yaks/mapper/control/field_spec.rb in yaks-0.7.6
- old
+ new
@@ -1,8 +1,10 @@
require 'spec_helper'
RSpec.describe Yaks::Mapper::Control::Field do
+ include_context 'yaks context'
+
let(:field) { described_class.new( full_args ) }
let(:name) { :the_field }
let(:full_args) { {name: name}.merge(args) }
let(:args) {
{
@@ -10,10 +12,12 @@
type: 'text',
value: 'hello'
}
}
+ let(:mapper) { Yaks::Mapper.new(yaks_context) }
+
describe '.create' do
it 'can take all args as a hash' do
expect(described_class.create(full_args)).to eql described_class.new(full_args)
end
@@ -26,9 +30,9 @@
end
end
describe '#to_resource_field' do
it 'creates a Yaks::Resource::Control::Field with the same attributes' do
- expect(field.to_resource_field).to eql Yaks::Resource::Control::Field.new(full_args)
+ expect(field.to_resource(mapper)).to eql Yaks::Resource::Control::Field.new(full_args)
end
end
end