Sha256: 6c823a185836c655dade8318a64f3474fabdd8c366f6727819bfd0c87d7e3274

Contents?: true

Size: 1.38 KB

Versions: 16

Compression:

Stored size: 1.38 KB

Contents

require 'rack/test'
require 'riot'

Riot.pretty_dots

class Riot::Situation
  include Rack::Test::Methods

  # Construct all the users needed for testing
  def create_users!
    User.delete_all; PhoneNumber.delete_all
    @user1 = User.create!(:username => "billybob", :email => "billy@bob.com", :location => "SF", :is_admin => false)
    @user2 = User.create!(:username => "joefrank", :email => "joe@frank.com", :location => "LA", :is_admin => false)
    @user3 = User.create!(:username => "suziesmith", :email => "suzie@smith.com", :location => "NYC", :is_admin => true)
    @users = [@user1, @user2, @user3]
    pn_ops = { :area_code => "#{rand(9).to_s*3}", :prefix => "#{rand(9).to_s*3}", :suffix => "#{rand(9).to_s*4}"}
    PhoneNumber.create(pn_ops.merge(:is_primary => true, :name => "Home", :user_id => @user1.id))
    PhoneNumber.create(pn_ops.merge(:is_primary => false, :name => "Work", :user_id => @user1.id))
    PhoneNumber.create(pn_ops.merge(:is_primary => true, :name => "Home", :user_id => @user2.id))
    PhoneNumber.create(pn_ops.merge(:is_primary => true, :name => "Home", :user_id => @user3.id))
  end
end

class Riot::Context
  # Set the Rack app which is to be tested.
  #
  #   context "MyApp" do
  #     app { [200, {}, "Hello!"] }
  #     setup { get '/' }
  #     asserts(:status).equals(200)
  #   end
  def app(app=nil, &block)
    setup { @app = (app || block.call) }
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rabl-0.6.1 test/integration/test_init.rb
rabl-0.6.0 test/integration/test_init.rb
rabl-0.5.5.j test/integration/test_init.rb
rabl-0.5.5.i test/integration/test_init.rb
rabl-0.5.5.h test/integration/test_init.rb
rabl-0.5.5.g test/integration/test_init.rb
rabl-0.5.5.f test/integration/test_init.rb
rabl-0.5.5.e test/integration/test_init.rb
rabl-0.5.5.d test/integration/test_init.rb
rabl-0.5.5.c test/integration/test_init.rb
rabl-0.5.5.b test/integration/test_init.rb
rabl-0.5.5.a test/integration/test_init.rb
rabl-0.5.4 test/integration/test_init.rb
rabl-0.5.3 test/integration/test_init.rb
rabl-0.5.1 test/integration/test_init.rb
rabl-0.5.0 test/integration/test_init.rb