Sha256: bf6d157a84db9c184ec0905f462053eae28507b4ee1e6f318172e129dcb55d05

Contents?: true

Size: 760 Bytes

Versions: 4

Compression:

Stored size: 760 Bytes

Contents

module Spec
  module Rails
    module DSL
      class AssignsHashProxy #:nodoc:
        def initialize(object)
          @object = object
        end

        def [](ivar)
          if assigns.include?(ivar.to_s)
            assigns[ivar.to_s]
          elsif assigns.include?(ivar)
            assigns[ivar]
          else
            nil
          end
        end

        def []=(ivar, val)
          assigns[ivar.to_s] = val
        end

        def delete(name)
          assigns.delete(name.to_s)
        end

        def each(&block)
          assigns.each &block
        end

        def has_key?(key)
          assigns.key?(key.to_s)
        end

        protected
        def assigns
          @object.assigns
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
deckshuffler-0.0.2 vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/assigns_hash_proxy.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/assigns_hash_proxy.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/assigns_hash_proxy.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/assigns_hash_proxy.rb