Sha256: 7d9c47346711bff2bb791a1e0dcc23c211b6eb051ae6ef497c767f252258cc74

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

require "rubygems"
require "message_block"
require "active_support"
require "active_model"
require "action_pack"
require "action_view"

class Post
  extend ActiveModel::Naming

  attr_accessor :name
  attr_reader :errors

  def initialize
    @errors = ActiveModel::Errors.new(self)
    @errors.add(:name, "can't be blank")
  end
  
  def read_attribute_for_validation(attr)
    send(attr)
  end
  
  def self.human_attribute_name(attr, options = {})
    attr
  end
  
  def self.lookup_ancestors
    [self]
  end
end

class User
  extend ActiveModel::Naming

  attr_accessor :name
  attr_reader :errors

  def initialize
    @errors = ActiveModel::Errors.new(self)
    @errors.add(:name, "can't be blank")
  end
  
  def read_attribute_for_validation(attr)
    send(attr)
  end
  
  def self.human_attribute_name(attr, options = {})
    attr
  end
  
  def self.lookup_ancestors
    [self]
  end
end


def controller
  @controller ||= Class.new {
    def controller_name
      "widgets_controller"
    end
  }.new
end

def posts_controller
  Class.new {
    def controller_name
      "posts_controller"
    end
  }.new
end

def flash
  @flash ||= {}
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
message_block-2.0.3 spec/spec_helper.rb
message_block-2.0.2 spec/spec_helper.rb
message_block-2.0.1 spec/spec_helper.rb
message_block-2.0.0 spec/spec_helper.rb