Sha256: 0e7ec02e159bd53e6d904426339b08eca80a7131ce1de5d4a8870645ae786d57
Contents?: true
Size: 1.17 KB
Versions: 5
Compression:
Stored size: 1.17 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper.rb' require 'annotate/annotate_models' describe AnnotateModels do def mock_klass(stubs={}) @mock_file ||= mock("Klass", stubs) end def mock_column(stubs={}) @mock_column ||= mock("Column", stubs) end it { AnnotateModels.quote(nil).should eql("NULL") } it { AnnotateModels.quote(true).should eql("TRUE") } it { AnnotateModels.quote(false).should eql("FALSE") } it { AnnotateModels.quote(25).should eql("25") } it { AnnotateModels.quote(25.6).should eql("25.6") } it { AnnotateModels.quote(1e-20).should eql("1.0e-20") } it "should get schema info" do AnnotateModels.get_schema_info(mock_klass( :table_name => "users", :primary_key => "id", :column_names => ["id","login"], :columns => [ mock_column(:type => "integer", :default => nil, :null => false, :name => "id", :limit => nil), mock_column(:type => "string", :default => nil, :null => false, :name => "name", :limit => 50) ]), "Hello").should eql("# Hello\n#\n# Table name: users\n#\n# id :integer not null, primary key\n# id :integer not null, primary key\n#\n\n") end end
Version data entries
5 entries across 5 versions & 2 rubygems