Sha256: 6caa9e67860fb58b2f449e9af8cbb18fba6b50326a866cc6274bb4201d91abf8

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

Bundler.require_env(:test)
require File.join(File.dirname(__FILE__), '..', 'lib', '<%= name %>')
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

2 entries across 2 versions & 1 rubygems

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