Sha256: 69b44920d8780cff6f013906ccfb14d3ffceb1a2744fe1f67763c12412a78704

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require File.join(File.dirname(__FILE__), '..', 'config/hydro_app')

describe "HydroApp" do
  describe "with bad arguments" do
    it "should raise an error" do
      lambda { HydroApp.new }.should raise_error
    end
  end

  describe "with users table" do
    include Rack::Test::Methods

    before(:all) do
      @db = prepare_test_db
    end

    before(:each) do
      populate_test_db
    end

    def app
      @app || HydroApp.new
    end

    describe "/dupe/*" do
      it "should open dupe/index.erb" do
        get '/dupe/users'
        last_response.should be_ok
      end

      it "should show the table's count" do
        get '/dupe/users'
        last_response.body.include?("Count: " + @db[:users].count.to_s).should be_true
      end
    end

    describe "/dupe/*" do
      it "should copy the first row n times" do
        post '/dupe/users', {:count => 10}.to_json
        last_response.should be_ok
        @db[:users].count.should == 10
      end

      it "should return the time elapsed on success" do
        post '/dupe/users', {:count => 10}.to_json
        last_response.body.match(/s$/).should be_true
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hydroponics-0.3.2 spec/hydro_app_spec.rb
hydroponics-0.3.1 spec/hydro_app_spec.rb
hydroponics-0.3.0 spec/hydro_app_spec.rb