Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added basic specs for Migration#select.

  • Loading branch information...
commit 05048a057da11a965dfe84e4bad5b0130b399064 1 parent 7de4584
Postmodern postmodern authored dkubb committed
Showing with 20 additions and 0 deletions.
  1. +4 −0 spec/integration/migration_spec.rb
  2. +16 −0 spec/unit/migration_spec.rb
4 spec/integration/migration_spec.rb
View
@@ -123,6 +123,10 @@
@migration.should respond_to(:execute)
end
+ it "should make available an #select method" do
+ @migration.should respond_to(:select)
+ end
+
it "should run the sql passed into the #execute method"
# TODO: Find out how to stub the DataMapper::database.execute method
end
16 spec/unit/migration_spec.rb
View
@@ -190,6 +190,22 @@
end
end
+ describe '#execute' do
+ before do
+ @adapter.stub!(:select)
+ end
+
+ it 'should send the SQL it its executing to the adapter execute method' do
+ @adapter.should_receive(:select).with('SELECT SOME SQL')
+ @m.select('SELECT SOME SQL')
+ end
+
+ it 'should output the SQL it is executing' do
+ @m.should_receive(:write).with(/SELECT SOME SQL/)
+ @m.select('SELECT SOME SQL')
+ end
+ end
+
describe 'helpers' do
before do
@m.stub!(:execute) # don't actually run anything
Please sign in to comment.
Something went wrong with that request. Please try again.