jaribio_formatter 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +50 -0
- data/Rakefile +21 -0
- data/jaribio_formatter.gemspec +25 -0
- data/lib/jaribio/execution.rb +9 -0
- data/lib/jaribio/formatter/version.rb +5 -0
- data/lib/jaribio/plan.rb +13 -0
- data/lib/jaribio/record.rb +86 -0
- data/lib/jaribio/remote_object.rb +28 -0
- data/lib/jaribio/rspec_formatter.rb +219 -0
- data/lib/jaribio/test_case.rb +5 -0
- data/lib/jaribio_formatter.rb +3 -0
- data/spec/jaribio.txt +15 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/app.js +88 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +363 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +44 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/favicon_green.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/favicon_red.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/favicon_yellow.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/highlight.css +129 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/highlight.pack.js +1 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/jquery-1.6.2.min.js +18 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/jquery.dataTables.min.js +152 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/jquery.timeago.js +141 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/jquery.url.js +174 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/loading.gif +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/magnify.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +295 -0
- data/spec/lib/jaribio/coverage/assets/0.5.3/stylesheet.css +383 -0
- data/spec/lib/jaribio/coverage/index.html +81 -0
- data/spec/lib/jaribio/execution_spec.rb +4 -0
- data/spec/lib/jaribio/plan_spec.rb +16 -0
- data/spec/lib/jaribio/record_spec.rb +59 -0
- data/spec/lib/jaribio/remote_object_spec.rb +34 -0
- data/spec/lib/jaribio/rspec_formatter_spec.rb +179 -0
- data/spec/spec_helper.rb +61 -0
- metadata +218 -0
data/README.rdoc
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
= jaribio-formatter
|
2
|
+
|
3
|
+
This gem contains:
|
4
|
+
|
5
|
+
* Jaribio::RSpecFormatter - An RSpec formatter that when configured appropriately will record test case execution for automated tests in jaribio.
|
6
|
+
|
7
|
+
== RSpec Configuration
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
# Can add the formatter here or on command line of rspec
|
11
|
+
config.add_formatter 'Jaribio::RSpecFormatter',
|
12
|
+
File.join(File.dirname(__FILE__), 'jaribio.txt')
|
13
|
+
|
14
|
+
# Configure the url to the installation of jaribio
|
15
|
+
config.jaribio_url = 'https://localhost/jaribio'
|
16
|
+
|
17
|
+
# Configure a jaribio api key, obtained from a user's profile page
|
18
|
+
config.jaribio_api_key = 'asdf1234'
|
19
|
+
|
20
|
+
# Optional, by default all open plans are updated
|
21
|
+
# Configure only specific plans to be updated.
|
22
|
+
config.jaribio_plans = [1, 2, 3]
|
23
|
+
|
24
|
+
# Optional, by default this is false and the formatter will not create
|
25
|
+
# missing test cases
|
26
|
+
config.jaribio_auto_create = true
|
27
|
+
end
|
28
|
+
|
29
|
+
== TODO
|
30
|
+
|
31
|
+
Eventually would like to include support for:
|
32
|
+
|
33
|
+
* test::unit
|
34
|
+
* cucumber
|
35
|
+
|
36
|
+
== Contributing to jaribio-formatter
|
37
|
+
|
38
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
39
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
40
|
+
* Fork the project.
|
41
|
+
* Start a feature/bugfix branch.
|
42
|
+
* Commit and push until you are happy with your contribution.
|
43
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
44
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
45
|
+
|
46
|
+
== Copyright
|
47
|
+
|
48
|
+
Copyright (c) 2012 bjones. See LICENSE.txt for
|
49
|
+
further details.
|
50
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'jaribio/formatter/version'
|
3
|
+
require 'rspec/core'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :spec
|
11
|
+
|
12
|
+
require 'rdoc/task'
|
13
|
+
Rake::RDocTask.new do |rdoc|
|
14
|
+
rdoc.rdoc_dir = 'rdoc'
|
15
|
+
rdoc.title = "jaribio_formatter #{Jaribio::Formatter::VERSION}"
|
16
|
+
rdoc.rdoc_files.include('README*')
|
17
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Disabling some tasks we can't/don't want to ever run
|
21
|
+
task(:release).clear_prerequisites.clear_actions
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "jaribio/formatter/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "jaribio_formatter"
|
7
|
+
s.version = Jaribio::Formatter::VERSION
|
8
|
+
s.date = Time.now.utc.strftime("%Y-%m-%d")
|
9
|
+
s.authors = ["C. Brian Jones"]
|
10
|
+
s.email = "cbjones1@gmail.com"
|
11
|
+
s.homepage = "https://github.com/bithckr/Jaribio/tree/master/jaribio_formatter"
|
12
|
+
s.license = "MIT"
|
13
|
+
s.summary = %Q{Jaribio test framework formatters}
|
14
|
+
s.description = %Q{Provide the necessary code to record execution results in Jaribio while running tests in RSpec}
|
15
|
+
s.files = Dir.glob("{lib,spec}/**/*") + %w(README.rdoc Rakefile jaribio_formatter.gemspec)
|
16
|
+
s.test_files = Dir.glob("{spec}/**/*")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.required_rubygems_version = ">= 1.8.10"
|
19
|
+
|
20
|
+
s.add_runtime_dependency 'activeresource', '~> 3.1.1'
|
21
|
+
|
22
|
+
s.add_development_dependency 'rake', '~> 0.9.2.2'
|
23
|
+
s.add_development_dependency 'rdoc', '3.12'
|
24
|
+
s.add_development_dependency 'rspec', '~> 2.8.0'
|
25
|
+
end
|
data/lib/jaribio/plan.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'jaribio/plan'
|
2
|
+
require 'jaribio/test_case'
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
module Jaribio
|
6
|
+
class Record
|
7
|
+
PASS = 1
|
8
|
+
FAIL = 2
|
9
|
+
|
10
|
+
attr_accessor :key, :description, :state, :error, :output
|
11
|
+
|
12
|
+
def initialize(args = {})
|
13
|
+
self.key = args[:key]
|
14
|
+
self.description = args[:description]
|
15
|
+
self.state = args[:state]
|
16
|
+
self.error = args[:error]
|
17
|
+
self.output = args[:output] || $stdout
|
18
|
+
end
|
19
|
+
|
20
|
+
def failed?
|
21
|
+
self.state != PASS
|
22
|
+
end
|
23
|
+
|
24
|
+
def ==(other)
|
25
|
+
(self.key == other.key and
|
26
|
+
self.description == other.description and
|
27
|
+
self.state == other.state)
|
28
|
+
end
|
29
|
+
|
30
|
+
def eql?(other)
|
31
|
+
self == other
|
32
|
+
end
|
33
|
+
|
34
|
+
def save(plans = [])
|
35
|
+
begin
|
36
|
+
test_case = Jaribio::TestCase.find(CGI::escape(self.key))
|
37
|
+
rescue ActiveResource::ResourceNotFound
|
38
|
+
output.puts "# Test case #{self.key} not found"
|
39
|
+
return
|
40
|
+
end
|
41
|
+
if (test_case.nil?)
|
42
|
+
output.puts "# Test case #{self.key} not found"
|
43
|
+
return
|
44
|
+
end
|
45
|
+
|
46
|
+
return unless test_case.attributes.has_key?(:plans)
|
47
|
+
plan_ids = Hash[ test_case.plans.map { |x| [x.id, 1] } ]
|
48
|
+
|
49
|
+
# Configured plans in this block
|
50
|
+
plans.each do |plan|
|
51
|
+
# verify test case is part of this plan
|
52
|
+
next unless plan_ids.has_key?(plan.id)
|
53
|
+
|
54
|
+
# create execution
|
55
|
+
create_execution(test_case, plan)
|
56
|
+
end
|
57
|
+
|
58
|
+
# No configured plans, try to update any open plan for each test case
|
59
|
+
if (plans.size == 0)
|
60
|
+
test_case.plans.each do |plan|
|
61
|
+
create_execution(test_case, plan)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def create_execution(test_case, plan)
|
69
|
+
return unless plan.open?
|
70
|
+
execution = Jaribio::Execution.new(
|
71
|
+
:status_code => self.state,
|
72
|
+
:results => self.error
|
73
|
+
)
|
74
|
+
execution.prefix_options = {:plan_id => plan.id, :test_case_id => test_case.id}
|
75
|
+
begin
|
76
|
+
execution.save()
|
77
|
+
output.puts "# Saving execution of #{test_case.unique_key} - #{test_case.name} for plan #{plan.id} - #{plan.name}"
|
78
|
+
rescue Exception => e
|
79
|
+
output.puts "# Error saving execution of #{test_case.unique_key} - #{test_case.name} for plan #{plan.id} - #{plan.name}: #{e.message}"
|
80
|
+
output.puts e.backtrace
|
81
|
+
end
|
82
|
+
return execution
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'active_resource'
|
2
|
+
require 'active_support/core_ext/class/attribute_accessors'
|
3
|
+
|
4
|
+
module Jaribio
|
5
|
+
class RemoteObject < ActiveResource::Base
|
6
|
+
cattr_accessor :api_key
|
7
|
+
|
8
|
+
# use json, not xml
|
9
|
+
self.format = :json
|
10
|
+
|
11
|
+
class << self
|
12
|
+
# Override query_string to automatically add the api_key
|
13
|
+
def query_string(options)
|
14
|
+
options = {} if options.nil?
|
15
|
+
options[:api_key] = api_key unless api_key.nil?
|
16
|
+
super(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def configure(config)
|
20
|
+
self.site = config.jaribio_url
|
21
|
+
self.api_key = config.jaribio_api_key
|
22
|
+
# set timeout (does not affect DNS lookups generally)
|
23
|
+
self.timeout = config.jaribio_timeout
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,219 @@
|
|
1
|
+
require 'jaribio/record'
|
2
|
+
require 'rspec/core'
|
3
|
+
require 'cgi'
|
4
|
+
require 'base64'
|
5
|
+
require 'digest/md5'
|
6
|
+
|
7
|
+
module Jaribio
|
8
|
+
class RSpecFormatter
|
9
|
+
|
10
|
+
attr_reader :output, :results, :example_group
|
11
|
+
|
12
|
+
def initialize(output)
|
13
|
+
@output = output || StringIO.new
|
14
|
+
@results = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def start(example_count)
|
18
|
+
end
|
19
|
+
|
20
|
+
def example_group_started(example_group)
|
21
|
+
@example_group = example_group
|
22
|
+
end
|
23
|
+
|
24
|
+
def example_group_finished(example_group)
|
25
|
+
end
|
26
|
+
|
27
|
+
def example_started(example)
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Mark example as passed via unique key
|
32
|
+
#
|
33
|
+
def example_passed(example)
|
34
|
+
record_result(example)
|
35
|
+
end
|
36
|
+
|
37
|
+
def example_pending(example)
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Mark example as failed via unique key
|
42
|
+
#
|
43
|
+
def example_failed(example)
|
44
|
+
record_result(example, true)
|
45
|
+
end
|
46
|
+
|
47
|
+
def message(message)
|
48
|
+
end
|
49
|
+
|
50
|
+
def stop
|
51
|
+
end
|
52
|
+
|
53
|
+
def start_dump()
|
54
|
+
end
|
55
|
+
|
56
|
+
def dump_pending()
|
57
|
+
end
|
58
|
+
|
59
|
+
def dump_failures()
|
60
|
+
end
|
61
|
+
|
62
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
63
|
+
output.puts "1..#{results.size}"
|
64
|
+
results.each_with_index do |data, index|
|
65
|
+
result = data[1]
|
66
|
+
status = (result.failed?) ? "not ok" : "ok"
|
67
|
+
count = index + 1
|
68
|
+
output.puts "#{status} #{count} - (#{result.key}) #{result.description}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# no-op
|
73
|
+
def seed(seed)
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Update Jaribio
|
78
|
+
# - configured to update pass/fail?
|
79
|
+
# - configured to output a report (for the purpose of updating your specs)
|
80
|
+
# - configured to generate plan/suite/test case?
|
81
|
+
#
|
82
|
+
def close()
|
83
|
+
Jaribio::RemoteObject.configure(configuration)
|
84
|
+
# create missing test cases, the new test cases are not automatically
|
85
|
+
# added to any plan
|
86
|
+
if RSpec.configuration.jaribio_auto_create
|
87
|
+
results.values.each do |record|
|
88
|
+
begin
|
89
|
+
test_case = Jaribio::TestCase.find(CGI::escape(record.key))
|
90
|
+
rescue ActiveResource::ResourceNotFound
|
91
|
+
end
|
92
|
+
if (test_case.nil?)
|
93
|
+
test_case = Jaribio::TestCase.new(
|
94
|
+
:name => record.description,
|
95
|
+
:unique_key => record.key,
|
96
|
+
:automated => true
|
97
|
+
)
|
98
|
+
begin
|
99
|
+
test_case.save
|
100
|
+
output.puts "# Created test case with unique key #{record.key}"
|
101
|
+
rescue Exception => e
|
102
|
+
output.puts "# Error creating test case #{record.key}: #{e.message}"
|
103
|
+
output.puts e.backtrace
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
plans = []
|
110
|
+
# create executions for specific plans only
|
111
|
+
if RSpec.configuration.jaribio_plans.size > 0
|
112
|
+
RSpec.configuration.jaribio_plans.each do |plan_id|
|
113
|
+
begin
|
114
|
+
plan = Jaribio::Plan.find(plan_id)
|
115
|
+
if plan.open?
|
116
|
+
plans << plan
|
117
|
+
else
|
118
|
+
output.puts "# RSpec configuration includes closed plan #{plan_id}"
|
119
|
+
end
|
120
|
+
rescue ActiveResource::ResourceNotFound
|
121
|
+
output.puts "# RSpec configuration of jaribio_plans includes unknown plan_id #{plan_id}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
results.each_value do |record|
|
127
|
+
record.save(plans)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
protected
|
132
|
+
|
133
|
+
def configuration
|
134
|
+
RSpec.configuration
|
135
|
+
end
|
136
|
+
|
137
|
+
def record_result(example, failed = false)
|
138
|
+
key, desc = get_example_key(example)
|
139
|
+
if (@results.has_key?(key))
|
140
|
+
failed = failed || @results[key].failed?
|
141
|
+
end
|
142
|
+
error = nil
|
143
|
+
if (example.execution_result.has_key?(:exception))
|
144
|
+
exception = example.execution_result[:exception]
|
145
|
+
unless (exception.nil?)
|
146
|
+
error = "#{exception.message}\n#{exception.backtrace}"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
record = Record.new(:key => key, :description => desc, :state => failed ? Jaribio::Record::FAIL : Jaribio::Record::PASS, :error => error, :output => output)
|
150
|
+
@results[key] = record
|
151
|
+
end
|
152
|
+
|
153
|
+
#
|
154
|
+
# Should this return?
|
155
|
+
# - jaribio_key if set (and desc based on that)
|
156
|
+
# - otherwise
|
157
|
+
# -- example_group full description (md5)
|
158
|
+
#
|
159
|
+
def get_example_key(example)
|
160
|
+
key, desc = find_jaribio_key(example)
|
161
|
+
if (key.nil?)
|
162
|
+
key = example_group.metadata[:example_group][:full_description]
|
163
|
+
desc = key
|
164
|
+
key = Base64.strict_encode64(Digest::MD5.digest(key))
|
165
|
+
end
|
166
|
+
return key, desc
|
167
|
+
end
|
168
|
+
|
169
|
+
#
|
170
|
+
# metadata of a group is shared with descendants
|
171
|
+
# must check ancestors until key not found (if it is found)
|
172
|
+
#
|
173
|
+
def find_jaribio_key(example)
|
174
|
+
key, desc = nil, nil
|
175
|
+
if defined? example.metadata and example.metadata.has_key?(:jaribio_key)
|
176
|
+
key = example.metadata[:jaribio_key]
|
177
|
+
desc = example.full_description
|
178
|
+
end
|
179
|
+
group = example_group
|
180
|
+
while (key.nil? and defined? group) do
|
181
|
+
key = group.metadata[:jaribio_key]
|
182
|
+
desc = group.metadata[:example_group][:full_description]
|
183
|
+
break if group.top_level?
|
184
|
+
group = group.superclass
|
185
|
+
end
|
186
|
+
|
187
|
+
# after finding the first instance of the key, continue
|
188
|
+
# checking up the chain to be sure this where it is defined
|
189
|
+
while (defined? key)
|
190
|
+
if group.metadata.has_key?(:jaribio_key)
|
191
|
+
if (group.metadata[:jaribio_key] != key)
|
192
|
+
break
|
193
|
+
else
|
194
|
+
desc = group.metadata[:example_group][:full_description]
|
195
|
+
end
|
196
|
+
else
|
197
|
+
break
|
198
|
+
end
|
199
|
+
break if group.top_level?
|
200
|
+
group = group.superclass
|
201
|
+
end
|
202
|
+
|
203
|
+
return key, desc
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.configure()
|
207
|
+
RSpec.configure do |c|
|
208
|
+
c.add_setting :jaribio_url
|
209
|
+
c.add_setting :jaribio_api_key
|
210
|
+
c.add_setting :jaribio_plans, :default => []
|
211
|
+
c.add_setting :jaribio_auto_create, :default => false
|
212
|
+
c.add_setting :jaribio_timeout, :default => 5
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
RSpecFormatter.configure
|
218
|
+
end
|
219
|
+
|
data/spec/jaribio.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
1..10
|
2
|
+
ok 1 - (wRq7gMRkRJeHnqZxkqkDng==) Jaribio::Plan#open?
|
3
|
+
ok 2 - (tccJHXEmFLwXeHzoPzRG+g==) Jaribio::Record#failed?
|
4
|
+
ok 3 - (I6JDDF4nqkrcAwC3ZGArJw==) Jaribio::Record#eql?
|
5
|
+
ok 4 - (9AfA585llnqxPxpEXNJcGg==) Jaribio::Record#save
|
6
|
+
ok 5 - (pBw77Ov/D/ZvKtAqJOMp8g==) Jaribio::RemoteObject#query_string
|
7
|
+
ok 6 - (QNi21vVeqvCyXIIg2/hlSA==) Jaribio::RemoteObject#configure
|
8
|
+
ok 7 - (XXpQMW5Ii4t2f6WSeWhxZg==) Jaribio::RSpecFormatter#get_example_key
|
9
|
+
ok 8 - (1ytapaYfeTdvJQ/dZzKSXg==) Jaribio::RSpecFormatter#results
|
10
|
+
ok 9 - (XcEQFeZVa+8E6UUmVFGjuw==) Jaribio::RSpecFormatter#close
|
11
|
+
ok 10 - (Gz4dbtEYCTJAgQrD4iEhGg==) Jaribio::RSpecFormatter can configure
|
12
|
+
# Saving execution of XXpQMW5Ii4t2f6WSeWhxZg== - Jaribio::RSpecFormatter#get_example_key for plan 5 - jaribio_formatter
|
13
|
+
# Saving execution of 1ytapaYfeTdvJQ/dZzKSXg== - Jaribio::RSpecFormatter#results for plan 5 - jaribio_formatter
|
14
|
+
# Saving execution of XcEQFeZVa+8E6UUmVFGjuw== - Jaribio::RSpecFormatter#close for plan 5 - jaribio_formatter
|
15
|
+
# Saving execution of Gz4dbtEYCTJAgQrD4iEhGg== - Jaribio::RSpecFormatter can configure for plan 5 - jaribio_formatter
|
@@ -0,0 +1,88 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
// Configuration for fancy sortable tables for source file groups
|
3
|
+
$('.file_list').dataTable({
|
4
|
+
"aaSorting": [[ 1, "asc" ]],
|
5
|
+
"bPaginate": false,
|
6
|
+
"bJQueryUI": true,
|
7
|
+
"aoColumns": [
|
8
|
+
null,
|
9
|
+
{ "sType": "percent" },
|
10
|
+
null,
|
11
|
+
null,
|
12
|
+
null,
|
13
|
+
null,
|
14
|
+
null
|
15
|
+
]
|
16
|
+
});
|
17
|
+
|
18
|
+
// Syntax highlight all files up front - deactivated
|
19
|
+
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
20
|
+
|
21
|
+
// Syntax highlight source files on first toggle of the file view popup
|
22
|
+
$("a.src_link").click(function() {
|
23
|
+
// Get the source file element that corresponds to the clicked element
|
24
|
+
var source_table = $($(this).attr('href'));
|
25
|
+
|
26
|
+
// If not highlighted yet, do it!
|
27
|
+
if (!source_table.hasClass('highlighted')) {
|
28
|
+
source_table.find('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
29
|
+
source_table.addClass('highlighted');
|
30
|
+
};
|
31
|
+
});
|
32
|
+
|
33
|
+
// Set-up of popup for source file views
|
34
|
+
$("a.src_link").fancybox({
|
35
|
+
'hideOnContentClick': true,
|
36
|
+
'centerOnScroll': true,
|
37
|
+
'width': '90%',
|
38
|
+
'padding': 0,
|
39
|
+
'transitionIn': 'elastic'
|
40
|
+
});
|
41
|
+
|
42
|
+
// Hide src files and file list container after load
|
43
|
+
$('.source_files').hide();
|
44
|
+
$('.file_list_container').hide();
|
45
|
+
|
46
|
+
// Add tabs based upon existing file_list_containers
|
47
|
+
$('.file_list_container h2').each(function(){
|
48
|
+
var container_id = $(this).parent().attr('id');
|
49
|
+
var group_name = $(this).find('.group_name').first().html();
|
50
|
+
var covered_percent = $(this).find('.covered_percent').first().html();
|
51
|
+
|
52
|
+
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' ('+ covered_percent +')</a></li>');
|
53
|
+
});
|
54
|
+
|
55
|
+
$('.group_tabs a').each( function() {
|
56
|
+
$(this).addClass($(this).attr('href').replace('#', ''));
|
57
|
+
});
|
58
|
+
|
59
|
+
// Make sure tabs don't get ugly focus borders when active
|
60
|
+
$('.group_tabs a').live('focus', function() { $(this).blur(); });
|
61
|
+
|
62
|
+
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
|
63
|
+
$('.group_tabs a').live('click', function(){
|
64
|
+
if (!$(this).parent().hasClass('active')) {
|
65
|
+
$('.group_tabs a').parent().removeClass('active');
|
66
|
+
$(this).parent().addClass('active');
|
67
|
+
$('.file_list_container').hide();
|
68
|
+
$(".file_list_container" + $(this).attr('href')).show();
|
69
|
+
window.location.href = window.location.href.split('#')[0] + $(this).attr('href').replace('#', '#_');
|
70
|
+
|
71
|
+
// Force favicon reload - otherwise the location change containing anchor would drop the favicon...
|
72
|
+
// Works only on firefox, but still... - Anyone know a better solution to force favicon on local file?
|
73
|
+
$('link[rel="shortcut icon"]').remove();
|
74
|
+
$('head').append('<link rel="shortcut icon" type="image/png" href="'+ favicon_path +'" />');
|
75
|
+
};
|
76
|
+
return false;
|
77
|
+
});
|
78
|
+
|
79
|
+
if (jQuery.url.attr('anchor')) {
|
80
|
+
$('.group_tabs a.'+jQuery.url.attr('anchor').replace('_', '')).click();
|
81
|
+
} else {
|
82
|
+
$('.group_tabs a:first').click();
|
83
|
+
};
|
84
|
+
|
85
|
+
$("abbr.timeago").timeago();
|
86
|
+
$('#loading').fadeOut();
|
87
|
+
$('#wrapper').show();
|
88
|
+
});
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|