Skip to content

Commit

Permalink
Added GithubProxy Tests (need to expand them)
Browse files Browse the repository at this point in the history
  • Loading branch information
wagenet committed Jan 19, 2011
1 parent be15bbc commit de76ab5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .autotest
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Autotest.add_hook :initialize do |at|
at.add_mapping(%r%^spec/(integration)/.*rb$%) {|filename, _|
at.add_mapping(%r%^spec/(integration|rack)/.*rb$%) {|filename, _|
filename
}

at.add_mapping(%r%^app/(controllers/(.+)_controller\.rb|views/(.+)/.+)$%) { |_, m|
["spec/integration/#{m[2]}_spec.rb"]
}

at.add_mapping(%r%^lib/rack/(.+).rb$%) { |_, m|
["spec/rack/#{m[1]}_spec.rb"]
}
end
2 changes: 1 addition & 1 deletion config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
require File.join(Rails.root, 'lib', 'github_proxy')
require File.join(Rails.root, 'lib', 'rack', 'github_proxy')

RubySwarm::Application.configure do
config.middleware.use GithubProxy
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions spec/rack/github_proxy_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

describe "Github Proxy" do
include Rack::Test::Methods

def app
Rack::Builder.app do
use GithubProxy
lambda { |env| [200, {'Content-Type' => 'text/plain'}, 'OK'] }
end
end

it "should pass-through non-matching calls" do
get "/"
last_response.body.should == 'OK'
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
require 'cancan/matchers'
require 'capybara/rails'
require 'capybara/rspec'
require 'rack/test'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Expand Down

0 comments on commit de76ab5

Please sign in to comment.