Sha256: a6634250549efdd1cb06207476dcb1f1b0e57836261c3c110a551884db12d97c

Contents?: true

Size: 1.39 KB

Versions: 61

Compression:

Stored size: 1.39 KB

Contents

require 'rack/test'
require 'riot'
require 'riot/rr'

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

61 entries across 61 versions & 2 rubygems

Version Path
rabl-0.14.3 test/integration/test_init.rb
rabl-0.14.2 test/integration/test_init.rb
rabl-0.14.1 test/integration/test_init.rb
rabl-0.14.0 test/integration/test_init.rb
rabl-0.13.1 test/integration/test_init.rb
rabl-0.13.0 test/integration/test_init.rb
rabl-0.12.0 test/integration/test_init.rb
rabl-0.11.8 test/integration/test_init.rb
rabl-0.11.7 test/integration/test_init.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/rabl-0.11.6/test/integration/test_init.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/rabl-0.11.6/test/integration/test_init.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/rabl-0.11.6/test/integration/test_init.rb
rabl-0.11.6 test/integration/test_init.rb
rabl-0.11.5 test/integration/test_init.rb
rabl-0.11.4 test/integration/test_init.rb
rabl-0.11.3 test/integration/test_init.rb
rabl-0.11.2 test/integration/test_init.rb
rabl-0.11.1 test/integration/test_init.rb
rabl-0.11.0 test/integration/test_init.rb
rabl-0.10.1 test/integration/test_init.rb