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.2.1 spec/support/examples.rb
rest_model-0.2.0 spec/support/examples.rb
rest_model-0.1.24 spec/support/examples.rb
rest_model-0.1.23 spec/support/examples.rb
rest_model-0.1.22 spec/support/examples.rb
rest_model-0.1.21 spec/support/examples.rb
rest_model-0.1.20 spec/support/examples.rb
rest_model-0.1.19 spec/support/examples.rb
rest_model-0.1.18 spec/support/examples.rb
rest_model-0.1.17 spec/support/examples.rb
rest_model-0.1.16 spec/support/examples.rb
rest_model-0.1.15 spec/support/examples.rb
rest_model-0.1.14 spec/support/examples.rb
rest_model-0.1.13 spec/support/examples.rb
rest_model-0.1.12 spec/support/examples.rb
rest_model-0.1.11 spec/support/examples.rb
rest_model-0.1.10 spec/support/examples.rb
rest_model-0.1.9 spec/support/examples.rb
rest_model-0.1.8 spec/support/examples.rb
rest_model-0.1.7 spec/support/examples.rb