aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/unit/relations/insertion_spec.rb
blob: b2b239097addbb361aa4c90b8c5035d1c26c0507 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')

module ActiveRelation
  describe Insertion do
    before do
      @relation = Table.new(:users)
    end
  
    describe '#to_sql' do
      it 'manufactures sql inserting the data for one item' do
        Insertion.new(@relation, @relation[:name] => "nick").to_sql.should be_like("
          INSERT
          INTO `users`
          (`users`.`name`) VALUES ('nick')
        ")
      end
    end
  end
end