Sha256: a46623e2f8cd5ca4b6ec500709bcd917d514fb75918815fa61d9a9656ef58b2d

Contents?: true

Size: 1.26 KB

Versions: 23

Compression:

Stored size: 1.26 KB

Contents

#
# Helpers for Context testing
#
# @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
#
module ContextExampleGroup
  def self.included(base)
    base.instance_eval do
      metadata[:type] = :context

      after do
        if Object.const_defined?(:ObjectClass)
          Object.send(:remove_const, :ObjectClass)
        end
      end

      let(:object_class) { Object.const_set(:ObjectClass, Class.new(Object)) }

      let(:object) { object_class.new }

      let(:object_resource) do
        object_class
        AdminIt::Resource.new(:object_class)
      end

      let(:object_context_class) do
        AdminIt::Context.create(:object, object_resource)
      end
      let(:object_context) { object_context_class.new }

      let(:single_object_context_class) do
        AdminIt::SingleContext.create(:single, object_resource)
      end
      let(:single_object_context) { single_object_context_class.new }

      let(:collection_object_context_class) do
        AdminIt::CollectionContext.create(:collection, object_resource)
      end
      let(:collection_object_context) { collection_object_context_class.new }
    end
  end

  RSpec.configure do |config|
    config.include(
      self,
      type: :context,
      example_group: { file_path: %r(spec/lib) }
    )
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
admin_it-1.3.8 spec/support/example_groups/context_example_group.rb
admin_it-1.3.7 spec/support/example_groups/context_example_group.rb
admin_it-1.3.6 spec/support/example_groups/context_example_group.rb
admin_it-1.3.5 spec/support/example_groups/context_example_group.rb
admin_it-1.3.4 spec/support/example_groups/context_example_group.rb
admin_it-1.3.3 spec/support/example_groups/context_example_group.rb
admin_it-1.3.2 spec/support/example_groups/context_example_group.rb
admin_it-1.3.1 spec/support/example_groups/context_example_group.rb
admin_it-1.3.0 spec/support/example_groups/context_example_group.rb
admin_it-1.2.8 spec/support/example_groups/context_example_group.rb
admin_it-1.2.7 spec/support/example_groups/context_example_group.rb
admin_it-1.2.6 spec/support/example_groups/context_example_group.rb
admin_it-1.2.5 spec/support/example_groups/context_example_group.rb
admin_it-1.2.4 spec/support/example_groups/context_example_group.rb
admin_it-1.2.3 spec/support/example_groups/context_example_group.rb
admin_it-1.2.2 spec/support/example_groups/context_example_group.rb
admin_it-1.2.1 spec/support/example_groups/context_example_group.rb
admin_it-1.2.0 spec/support/example_groups/context_example_group.rb
admin_it-1.1.0 spec/support/example_groups/context_example_group.rb
admin_it-1.0.11 spec/support/example_groups/context_example_group.rb