Sha256: 7ce8e4dc98f2336a34fdfac18b3404526a0842699a5540dbda8be894652d15e2

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'

describe 'model without orm' do
  use_orm :none

  before :each do  
    Rails3::Assist::Directory.rails_root = fixtures_dir
    
    delete_model(:account) # if has_model? :account                
    create_model :account do
      %q{def index
  end}
    end    
  end

  after :each do              
    remove_model :account
  end

  context "Non-existant model(s)" do
    it "should not fail trying to remove non-existant models" do
      remove_models :person, :user
      remove_artifacts :model, :person, :user

      remove_model :person
      remove_artifact :model, :person
    end
  
    it "should not find a non-existant model" do
      model_file :person do |person|
        fail "should not find person model!"
      end                                       
    
      has_model?(:person).should be_false
      has_models?(:person, :user).should be_false
    end
     
    it "should not insert into non-existant model" do
      insert_into_model(:person, :after => 'Hello', :content => 'Yes').should_not be_true
    end
  
    it "should not read from non-existant model" do
      read_model :person do |content|
        fail "should not find person content!"
      end.should_not be_true
    end   
  end
    
  it "should have an account_model file that contains an index method and two inserted comments" do
    insert_into_model :account, :content => '# hello'
    insert_into_model :account do
      '# goodbye'
    end
    puts read_model(:account)
    read_model(:account).should have_comment 'hello'

    # root_dir.should have_model :account do |model_file|
    #   model_file.should have_method :index
    #   model_file.should have_comment 'hello'
    #   model_file.should have_comment 'goodbye'
    # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails3_artifactor-0.2.1 spec/rails3_artifactor/artifact/crud/model_spec.rb