Sha256: a39023bf932f398c234550020718391d80c0e894004ec75c6f0654454f9fae77

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'gems', 'environment'))
require File.join(File.dirname(__FILE__), '..', 'lib', '<%= name %>')

require 'rack/test'
require 'webrat'
require 'dm-sweatshop'
require 'fakeweb'
require 'pp'

FakeWeb.allow_net_connect = false
ENV['<%= name.upcase %>_READKEY'] = /\w{18}/.gen
ENV['<%= name.upcase %>_READSECRET'] = /\w{18}/.gen

require File.dirname(__FILE__)+'/fixtures'
require File.dirname(__FILE__)+'/helpers'

Webrat.configure do |config|
  config.mode = :rack
  config.application_port = 4567
end

DataMapper.setup(:default, 'sqlite3::memory:')

Spec::Runner.configure do |config|
  config.include(Rack::Test::Methods)
  config.include(Webrat::Methods)
  config.include(Webrat::Matchers)
  config.include(<%= name.camelize %>::AppHelpers)

  config.before(:each) do
    ::<%= name.camelize %>::App.environment = :development
    DataMapper.auto_migrate!
    FakeWeb.clean_registry
    FakeWeb.register_uri(:post, "http://twitter.com:80/oauth/request_token",
      [{:body => "oauth_token=requestkey&oauth_token_secret=requestsecret", :status => ["200", "OK"]},
       {:body => "",            :status => ["401", "Unauthorized"]},
       {:body => "",            :status => ["403", "Forbidden"]},
       {:body => "Bad Gateway", :status => ["502", "Bad Gateway"]} ])
  end

  def app
    <%= name.camelize %>.app
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
singem-0.0.5 lib/generators/twitter/templates/spec/spec_helper.rb.erb