Module: Evergreen

Defined in:
lib/evergreen/reports.rb,
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

Overview

generates reports in junit xml for ci/jenkins

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'0.4.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.driverObject

Returns the value of attribute driver.



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

def driver
  @driver
end

.public_dirObject

Returns the value of attribute public_dir.



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

def public_dir
  @public_dir
end

.spec_dirObject

Returns the value of attribute spec_dir.



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

def spec_dir
  @spec_dir
end

.template_dirObject

Returns the value of attribute template_dir.



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

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
# File 'lib/evergreen/application.rb', line 2

def self.application(suite)
  Rack::Builder.new do
    instance_eval(&Evergreen.extensions) if Evergreen.extensions

    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



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

def configure
  yield self
end

.extensions(&block) ⇒ Object



25
26
27
28
# File 'lib/evergreen.rb', line 25

def extensions(&block)
  @extensions = block if block
  @extensions
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



30
31
32
33
34
35
36
37
# File 'lib/evergreen.rb', line 30

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