Sha256: 62c86f3fc7bd73a60b811e7e4eae4e0b170c40d52b8cc4cd1ddd87769593e48c

Contents?: true

Size: 1.7 KB

Versions: 7

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

describe 'model with Mongoid' do
  use_orm :mongoid

  before do
    RailsAssist::Directory.rails_root = File.dirname (__FILE__)
  end

  before :each do              
    remove_model :account        
    create_model :account do
      %q{def index
  end}
    end    
  end

  after :each do              
    # remove_model :account
  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 

describe 'model with Mongoid - embedded document' do
  use_orm :mongoid

  before :each do              
    remove_model :account        
    create_model :account, :model_type => :embedded do
      %q{def index
  end}
    end    
  end

  after :each do              
    # remove_model :account
  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

7 entries across 7 versions & 1 rubygems

Version Path
rails_artifactor-0.5.1 spec/rails_artifactor/artifact/orm/mongoid_spec.rb
rails_artifactor-0.5.0 spec/rails_artifactor/artifact/orm/mongoid_spec.rb
rails_artifactor-0.4.0 spec/rails_artifactor/artifact/orm/mongoid_spec.rb
rails_artifactor-0.3.6 spec/rails_artifactor/artifact/orm/mongoid_spec.rb
rails_artifactor-0.3.5 spec/rails_artifactor/artifact/orm/mongoid_spec.rb
rails_artifactor-0.3.4 spec/rails_artifactor/artifact/orm/mongoid_spec.rb
rails_artifactor-0.3.3 spec/rails_artifactor/artifact/orm/mongoid_spec.rb