Skip to content

Commit

Permalink
Added extensions to evergreen
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders Törnqvist and Antony Sastre committed Jan 14, 2011
1 parent b11394b commit c10f789
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/evergreen.rb
Expand Up @@ -21,6 +21,11 @@ def configure
yield self
end

def extensions(&block)
@extensions = block if block
@extensions
end

def use_defaults!
configure do |config|
config.driver = :selenium
Expand Down
2 changes: 2 additions & 0 deletions lib/evergreen/application.rb
@@ -1,6 +1,8 @@
module Evergreen
def self.application(suite)
Rack::Builder.new do
instance_eval(&Evergreen.extensions) if Evergreen.extensions

map "/jasmine" do
use Rack::Static, :urls => ["/"], :root => File.expand_path('../jasmine/lib', File.dirname(__FILE__))
run lambda { |env| [404, {}, "No such file"]}
Expand Down
5 changes: 5 additions & 0 deletions spec/evergreen_spec.rb
Expand Up @@ -21,4 +21,9 @@
page.should have_content("2 specs, 1 failure")
page.should have_content("Expected 'bar' to equal 'noooooo'.")
end

it "should add extensions to Evergreen" do
visit('/awesome')
page.should have_content('Totally awesome')
end
end
6 changes: 6 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -9,6 +9,12 @@

TEST_DRIVER = :envjs

Evergreen.extensions do
map "/awesome" do
run lambda { |env| [200, {}, "<html><body>Totally awesome</body></html>"]}
end
end

Capybara.app = Evergreen::Suite.new(File.expand_path('suite1', File.dirname(__FILE__))).application
Capybara.default_driver = TEST_DRIVER

Expand Down

0 comments on commit c10f789

Please sign in to comment.