Sha256: 3d66e2dbadb3036a443860b011a6b489971f04610e9b426002241c2fe07877ba
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require "rubygems" require "spec" require "active_support" require "action_view" require "message_block" require File.dirname(__FILE__) + '/../init' Spec::Runner.configure do |config| config.mock_with :mocha end # Borrowed model stubs from Rails active_record_helper_test.rb # TODO: Re-implement using mocha Post = Struct.new("Post", :title, :author_name) User = Struct.new("User", :email) def setup_post @post = Post.new def @post.errors Class.new do def on(field) case field.to_s when "author_name" "can't be empty" when "body" true else false end end def empty?() false end def count() 1 end def full_messages() [ "Author name can't be empty" ] end end.new end @post.title = "Hello World" @post.author_name = "" end def setup_user @user = User.new def @user.errors Class.new { def on(field) field == "email" end def empty?() false end def count() 1 end def full_messages() [ "User email can't be empty" ] end }.new end @user.email = "" 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
message_block-1.0 | spec/spec_helper.rb |