Sha256: fe16ff666c79ff50056fae1fb7dc487699de403861dd9c3167f1368fd6e256b5

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

require 'models/simple_article'

describe 'SimpleSpec' do
  it 'should be able to create and destroy a table' do
    CreateArticles.up
    article = Article.new
    article.title = 'Sample title'
    article.body = 'Sample body'
    article.save.should be_true
    CreateArticles.down
  end

  context 'basic activerecord functionality' do
    before(:all) do
      CreateArticles.up
    end
    
    it 'should autoincrement the `id` field' do
      Article.create(:title => 'auto_first', :body => 'auto_first')
      Article.create(:title => 'auto_second', :body => 'auto_second')
      articles = Article.all
      first = articles.select { |a| a.title == 'auto_first' }.first
      second = articles.select { |a| a.title == 'auto_second' }.first
      first.id.should_not eq(second.id)
    end

    it 'should populate the `created_at` field' do
      article = Article.create(:title => 'created_at test', :body => 'created_at test')
      article.created_at.should_not be_nil
    end

    it 'should populate the `updated_at` field' do
      article = Article.create(:title => 'created_at test', :body => 'created_at test')
      article.updated_at.should_not be_nil
    end

    it 'should be able to find(:where) an item' do
      article = Article.create(:title => 'reload', :body => 'reload')
      article = Article.where(:title => 'reload').first
      article.title.should eq('reload')
    end

    it 'should be able to #reload and item' do
      
    end

    after(:all) do
      CreateArticles.down
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-jdbcteradata-adapter-0.2.0 spec/simple_spec.rb