Module: Evergreen

Defined in:
lib/evergreen.rb,
lib/evergreen/cli.rb,
lib/evergreen/spec.rb,
lib/evergreen/rails.rb,
lib/evergreen/suite.rb,
lib/evergreen/runner.rb,
lib/evergreen/server.rb,
lib/evergreen/version.rb,
lib/evergreen/template.rb,
lib/evergreen/application.rb

Defined Under Namespace

Classes: Cli, Railtie, Runner, Server, Spec, Suite, Template

Constant Summary collapse

VERSION =
'0.4.0.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.driverObject

Returns the value of attribute driver.



18
19
20
# File 'lib/evergreen.rb', line 18

def driver
  @driver
end

.public_dirObject

Returns the value of attribute public_dir.



18
19
20
# File 'lib/evergreen.rb', line 18

def public_dir
  @public_dir
end

.spec_dirObject

Returns the value of attribute spec_dir.



18
19
20
# File 'lib/evergreen.rb', line 18

def spec_dir
  @spec_dir
end

.template_dirObject

Returns the value of attribute template_dir.



18
19
20
# File 'lib/evergreen.rb', line 18

def template_dir
  @template_dir
end

Class Method Details

.application(suite) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/evergreen/application.rb', line 2

def self.application(suite)
  Rack::Builder.new do
    map "/jasmine" do
      use Rack::Static, :urls => ["/"], :root => File.expand_path('../jasmine/lib', File.dirname(__FILE__))
      run lambda { |env| [404, {}, "No such file"]}
    end

    map "/resources" do
      use Rack::Static, :urls => ["/"], :root => File.expand_path('resources', File.dirname(__FILE__))
      run lambda { |env| [404, {}, "No such file"]}
    end

    map "/" do
      app = Class.new(Sinatra::Base).tap do |app|
        app.reset!
        app.class_eval do
          set :static, true
          set :root, File.expand_path('.', File.dirname(__FILE__))
          set :public, File.expand_path(File.join(suite.root, Evergreen.public_dir), File.dirname(__FILE__))

          helpers do
            def url(path)
              request.env['SCRIPT_NAME'].to_s + path.to_s
            end
          end

          get '/' do
            @suite = suite
            erb :list
          end

          get '/run/*' do |name|
            @suite = suite
            @spec = suite.get_spec(name)
            @js_spec_helper = suite.get_spec('spec_helper.js')
            @coffee_spec_helper = suite.get_spec('spec_helper.coffee')
            erb :spec
          end
        end
      end
      run app
    end
  end
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Evergreen)

    the object that the method was called on



20
21
22
# File 'lib/evergreen.rb', line 20

def configure
  yield self
end

.railsObject



5
6
7
# File 'lib/evergreen/rails.rb', line 5

def self.rails
  Evergreen::Suite.new(Rails.root).application
end

.use_defaults!Object



24
25
26
27
28
29
30
31
# File 'lib/evergreen.rb', line 24

def use_defaults!
  configure do |config|
    config.driver = :selenium
    config.public_dir = 'public'
    config.spec_dir = 'spec/javascripts'
    config.template_dir = 'spec/javascripts/templates'
  end
end