Sha256: b7a286a3c1166ac9a65a19279be349d5d6342be1a2fdf672c240956820f0cf7d
Contents?: true
Size: 1.22 KB
Versions: 11
Compression:
Stored size: 1.22 KB
Contents
require 'cooperator' subject Cooperator::Context spec 'dynamic setter and getter' do context = Cooperator::Context.new context.name = 'Apple' assert context.name, :==, 'Apple' end spec '.new accepts a hash' do context = Cooperator::Context.new name: 'Apple' assert context.name, :==, 'Apple' end spec '#errors is a hash of error messages' do context = Cooperator::Context.new assert context.errors, :is_a?, Hash end spec '#success! marks the context as a success' do context = Cooperator::Context.new context.success! assert context, :success? refute context, :failure? end spec '#failure! marks the context as a failure' do context = Cooperator::Context.new context.failure! assert context, :failure? refute context, :success? end spec '#failure! accepts an error key and message' do context = Cooperator::Context.new context.failure! action: 'Failure!' assert context.errors, :==, action: ['Failure!'] end spec '#include? returns true for an existing attribute' do context = Cooperator::Context.new name: 'Apple' assert context, :include?, :name end spec '#include? returns false for a non-existing attribute' do context = Cooperator::Context.new refute context, :include?, :name end
Version data entries
11 entries across 11 versions & 1 rubygems