Sha256: b96aa512ea67c83701f54cefe732340c2faf331b285a4eeaa9cce84ee22ecb46

Contents?: true

Size: 820 Bytes

Versions: 19

Compression:

Stored size: 820 Bytes

Contents

module Spec
  module Rails
    module Example
      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)
          @object.instance_variable_set "@#{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

19 entries across 19 versions & 4 rubygems

Version Path
jcnetdev-rspec-rails-1.1.5 lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
radiant-0.6.5.1 vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
radiant-0.6.5 vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
radiant-0.6.6 vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
radiant-0.6.7 vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
radiant-0.6.8 vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
radiant-0.6.9 vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb
spree-0.4.0 vendor/plugins/rspec-rails/lib/spec/rails/example/assigns_hash_proxy.rb
spree-0.4.1 vendor/plugins/rspec-rails/lib/spec/rails/example/assigns_hash_proxy.rb
spree-0.5.0 vendor/plugins/rspec-rails/lib/spec/rails/example/assigns_hash_proxy.rb
spree-0.5.1 vendor/plugins/rspec-rails/lib/spec/rails/example/assigns_hash_proxy.rb