Sha256: badf93967e5f8ffd4199d3241ef300a1a798674bdddccd24bed70348830e4311

Contents?: true

Size: 594 Bytes

Versions: 11

Compression:

Stored size: 594 Bytes

Contents

module RSpec
  module Rails
    module ViewAssigns
      extend ActiveSupport::Concern

      module InstanceMethods
        # :call-seq:
        #   assign(:widget, stub_model(Widget))
        #
        # Assigns a value to an instance variable in the scope of the
        # view being rendered.
        def assign(key, value)
          _encapsulated_assigns[key] = value
        end

      private

        def _encapsulated_assigns
          @_encapsulated_assigns ||= {}
        end

        def _assigns
          super.merge(_encapsulated_assigns)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.22 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.20 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.19 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.18 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.17 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.16 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.15 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.14.2 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.14.1 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.13 lib/rspec/rails/view_assigns.rb
rspec-rails-2.0.0.beta.12 lib/rspec/rails/view_assigns.rb