Sha256: f723bb8a2c6b3bccd65eaf16765540480916e6edd6ed3f0f5af26d2f7bd61c8f
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require File.join(File.dirname(__FILE__), "/spec_helper") describe Temping do include Temping describe ".create_model" do it "creates and returns an AR::Base-derived model" do posts = create_model :posts posts.ancestors.should include(ActiveRecord::Base) end it "evals all statements passed in through a block" do votes = create_model :votes do with_columns do |table| table.string :voter end validates_presence_of :voter end vote = Vote.new vote.should_not be_valid vote.voter = "John Pignata" vote.should be_valid end it "raises ModelAlreadyDefined if a const is already defined" do lambda { 2.times { create_model :dogs }}.should raise_error(Temping::ModelAlreadyDefined) end describe ".with_columns" do it "creates columns passed in through a block" do create_model :comments do with_columns do |table| table.integer :count table.string :headline table.text :body end end Comment.columns.map(&:name).should include("count", "headline", "body") end end end describe "database agnostism" do it "supports Sqlite3" do ActiveRecord::Base.establish_connection 'temping' create_model(:oranges).should == Orange end it "supports MySQL" do ActiveRecord::Base.establish_connection 'mysql' create_model(:apples).should == Apple end it "supports PostgreSQL" do ActiveRecord::Base.establish_connection 'postgres' create_model(:cherries).should == Cherry end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
temping-1.1.0 | spec/temping_spec.rb |