Sha256: 295ccf2a383a840f7df82904bf40f31f701c7acaf822f1a0d56f19d58c382d7f

Contents?: true

Size: 792 Bytes

Versions: 25

Compression:

Stored size: 792 Bytes

Contents

module Examples
  extend RSpec::Core::Hooks

  CONSTANTS = [:Root, :Item, :Customer, :Entry, :Phone,
               :Service, :Billing, :Developer, :Upcasing,
               :Camelizing, :Product, :Address]

  def describe_example(file, tags = {}, &block)
    describe "example #{file}", tags do
      before :all do
        CONSTANTS.each do |klass|
          self.class.ancestors.concat([self.class, Examples]).each do |mod|
            mod.send(:remove_const, klass) if mod.const_defined?(klass, false)
          end
        end

        RestModel::Configuration.configure do |c|
          c.convert_input_keys = RestModel::Configuration::DefaultHandler
        end

        silently {eval File.read("examples/#{file}.rb")}
      end

      instance_eval &block if block
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rest_model-0.1.6 spec/support/examples.rb
rest_model-0.1.5 spec/support/examples.rb
rest_model-0.1.4 spec/support/examples.rb
rest_model-0.1.3 spec/support/examples.rb
rest_model-0.1.2 spec/support/examples.rb