Sha256: 935ce0af1814b66ddf83d04a3f34b9a4987118c02c7cd1f017440265ef4a4211
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
require 'test/unit' require 'shoulda' require 'action_view' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'attrtastic' class Test::Unit::TestCase def html(string) string.split(/\n/m).map(&:strip).join end def setup_fixtures @user = User.new.tap do |u| u.first_name,u.last_name = "John","Doe" u.email = "john@doe.com" end @blog = Blog.new.tap{|b| b.name,b.url,b.author = "IT Pro Blog","http://www.it.pro.blog",@user} @blog.posts = [ Post.new.tap{|p| p.title,p.content = "Hello World!","Hello World!\nInitial post"}, Post.new.tap{|p| p.title,p.content = "Sorry","Sorry for long delay. Had much stuff on my head..."}, ] ActionView::Base.send :include, Attrtastic::SemanticAttributesHelper @template = ActionView::Base.new.tap{ |av| av.output_buffer = "" } @user_builder = Attrtastic::SemanticAttributesBuilder.new(@user, @template) @blog_builder = Attrtastic::SemanticAttributesBuilder.new(@blog, @template) end end class User attr_accessor :first_name, :last_name, :email, :title def full_name [last_name,first_name].join(", ") end end class Blog attr_accessor :name, :url, :author, :posts delegate :full_name, :to => :author, :prefix => true end class Post attr_accessor :title, :content end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
attrtastic-0.2.2 | test/helper.rb |
attrtastic-0.2.1 | test/helper.rb |
attrtastic-0.2.0 | test/helper.rb |