Sha256: 24e2dc46cedbbe635151453c27051b518cec163f28e71b5acafa6fac6a22cad9

Contents?: true

Size: 760 Bytes

Versions: 3

Compression:

Stored size: 760 Bytes

Contents

module MiniTestSpecRails
  module SharedTestCaseBehavior

    def self.included(klass)
      klass.class_eval do
        before           { setup_dummy_schema }
        let(:user_ken)   { User.create! :email => 'ken@metaskills.net' }
        let(:user_post)  { Post.create! :title => 'Test Title', :body => 'Test body. Test body.', :user => user_ken}
      end
    end

    private

    def setup_dummy_schema
      ActiveRecord::Base.class_eval do
        connection.instance_eval do
          create_table :users, :force => true do |t|
            t.string :email
          end
          create_table :posts, :force => true do |t|
            t.string  :title, :body
            t.integer :user_id
          end
        end
      end
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minitest-spec-rails-3.1.2 test/support/shared_test_case_behavior.rb
minitest-spec-rails-3.1.1 test/support/shared_test_case_behavior.rb
minitest-spec-rails-3.1.0 test/support/shared_test_case_behavior.rb