qlive 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -22
- data/lib/qlive/registry.rb +6 -15
- data/lib/qlive/version.rb +1 -1
- data/spec/fixtures/{suites/fancy_workflow → fancy_workflow}/fancy_workflow_qlive.rb +0 -0
- data/spec/fixtures/{suites/fancy_workflow → fancy_workflow}/post-new-recipe.js +0 -0
- data/spec/fixtures/{suites/fancy_workflow → fancy_workflow}/verify-creds.js +0 -0
- data/spec/fixtures/qunit_support/start-qunit.js +3 -5
- data/spec/fixtures/regressions/stay_unbroken/stay_unbroken_qlive.rb +10 -0
- data/spec/fixtures/regressions/stay_unbroken/test-never-again.js +5 -0
- data/spec/qlive/rack_spec.rb +1 -1
- data/spec/qlive/registry_spec.rb +12 -0
- metadata +16 -15
- data/.gitignore +0 -4
- data/lib/qlive/.DS_Store +0 -0
- data/spec/.DS_Store +0 -0
data/README.md
CHANGED
@@ -1,32 +1,16 @@
|
|
1
1
|
# Qlive
|
2
2
|
|
3
|
-
Qlive is rack middleware
|
4
|
-
It is mainly intended to be used for testing javascript-heavy, single-page web applications
|
5
|
-
(like those built using backbone, angularjs, emberjs, etc.)
|
3
|
+
This core Qlive gem is rack middleware that:
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
do things like popuplate content with your favorite fixtures library (like factory_girl) and log in a user for the qunit test page.
|
5
|
+
* provides hooks for setting server state before the request is processed by your app
|
6
|
+
* inserts the qunit framework and your test sources and helpers into the page's response.
|
10
7
|
|
11
8
|
|
12
|
-
|
9
|
+
If you are using Ruby on Rails, you should not use this gem directly. Instead, use
|
10
|
+
[qlive-rails](https://github.com/proxv/qlive-rails) or [qlive-rspec](https://github.com/proxv/qlive-rspec).
|
13
11
|
|
14
|
-
* Precisely set fixture content and user login state for your qunit tests
|
15
|
-
* Insert qunit tests and any custom html into live pages generated by your server
|
16
|
-
* Run the same qunit tests in a browser or headlessly, alongside your normal integration test suite. (When used with Ruby on Rails and the [qlive-rspec](https://github.com/proxv/qlive-rspec) gem.)
|
17
12
|
|
18
|
-
|
19
|
-
## Installation
|
20
|
-
|
21
|
-
### Ruby on Rails
|
22
|
-
|
23
|
-
If you are using Ruby on Rails, you should use one of these gems:
|
24
|
-
|
25
|
-
* [qlive-rails](https://github.com/proxv/qlive-rails). Configures most of qlive for you and provides an index page linking to your test suites.
|
26
|
-
* [qlive-rspec](https://github.com/proxv/qlive-rspec). Run your qunit tests headlessly as an rspec example. (Builds on qlive-rails.)
|
27
|
-
|
28
|
-
|
29
|
-
### Non-rails:
|
13
|
+
## Configuration
|
30
14
|
|
31
15
|
* Configure base path, the top of the directory tree that contains your qlive suites. (See suites section below)
|
32
16
|
<pre>Qlive.setup[:base_path] = /absolute/path/to/qunit/tests/tree</pre>
|
data/lib/qlive/registry.rb
CHANGED
@@ -4,17 +4,7 @@ require 'qlive/suite'
|
|
4
4
|
module Qlive
|
5
5
|
module Registry
|
6
6
|
|
7
|
-
unless String.public_method_defined?(:underscore)
|
8
|
-
String.class_eval do
|
9
|
-
def underscore
|
10
|
-
self.gsub(/(.)([A-Z])/,'\1_\2').downcase
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
7
|
$qlive_all_suites ||= {}
|
17
|
-
#@all_suites ||= {} # use module instance variable
|
18
8
|
|
19
9
|
def self.suites
|
20
10
|
$qlive_all_suites
|
@@ -56,16 +46,17 @@ module Qlive
|
|
56
46
|
meta
|
57
47
|
end
|
58
48
|
|
49
|
+
private
|
59
50
|
|
60
51
|
def self.extract_suite_name_from_path(path)
|
61
|
-
res = path.
|
62
|
-
res
|
63
|
-
res = res.downcase.sub(/_qlive$/, '')
|
64
|
-
res
|
52
|
+
res = path.sub(Qlive.setup[:base_path], '').sub(/^\//, '')
|
53
|
+
res.split('/')[0..-2].join('/')
|
65
54
|
end
|
66
55
|
|
67
56
|
def self.extract_suite_name_from_class(klass)
|
68
|
-
klass.name.
|
57
|
+
parts = klass.name.split('::')
|
58
|
+
parts = parts.map { |part| part.gsub(/(.)([A-Z])/,'\1_\2').downcase }
|
59
|
+
parts.join('/').sub(/_qlive$/, '')
|
69
60
|
end
|
70
61
|
|
71
62
|
end
|
data/lib/qlive/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/spec/qlive/rack_spec.rb
CHANGED
data/spec/qlive/registry_spec.rb
CHANGED
@@ -6,13 +6,25 @@ describe Qlive::Registry, "find_suites" do
|
|
6
6
|
suites.length.should > 0
|
7
7
|
suites['fancy_workflow'].should_not be_nil
|
8
8
|
end
|
9
|
+
|
10
|
+
it "should support subdirectories namespaced by modules" do
|
11
|
+
suites = Qlive::Registry.find_suites
|
12
|
+
suites.length.should == 2
|
13
|
+
suites['regressions/stay_unbroken'].should_not be_nil
|
14
|
+
end
|
9
15
|
end
|
10
16
|
|
17
|
+
|
11
18
|
describe Qlive::Registry, "build_suite" do
|
12
19
|
|
13
20
|
it "should instantiate suite and add class to meta data registry" do
|
14
21
|
suite = Qlive::Registry.build_suite('fancy_workflow')
|
15
22
|
suite.class.name.should == 'FancyWorkflowQlive'
|
23
|
+
end
|
16
24
|
|
25
|
+
it "should work with namespaced subdirs " do
|
26
|
+
suite = Qlive::Registry.build_suite('regressions/stay_unbroken')
|
27
|
+
suite.class.name.should == 'Regressions::StayUnbrokenQlive'
|
17
28
|
end
|
29
|
+
|
18
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qlive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152316140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.4'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152316140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152315360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152315360
|
36
36
|
description: run qunit tests against actual back-end server with prepared test fixtures
|
37
37
|
email:
|
38
38
|
- support@proxv.com
|
@@ -40,12 +40,10 @@ executables: []
|
|
40
40
|
extensions: []
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
|
-
- .gitignore
|
44
43
|
- Gemfile
|
45
44
|
- README.md
|
46
45
|
- Rakefile
|
47
46
|
- lib/qlive.rb
|
48
|
-
- lib/qlive/.DS_Store
|
49
47
|
- lib/qlive/dev_reload.rb
|
50
48
|
- lib/qlive/qunit_assets.rb
|
51
49
|
- lib/qlive/rack.rb
|
@@ -54,11 +52,12 @@ files:
|
|
54
52
|
- lib/qlive/suite.rb
|
55
53
|
- lib/qlive/version.rb
|
56
54
|
- qlive.gemspec
|
57
|
-
- spec
|
55
|
+
- spec/fixtures/fancy_workflow/fancy_workflow_qlive.rb
|
56
|
+
- spec/fixtures/fancy_workflow/post-new-recipe.js
|
57
|
+
- spec/fixtures/fancy_workflow/verify-creds.js
|
58
58
|
- spec/fixtures/qunit_support/start-qunit.js
|
59
|
-
- spec/fixtures/
|
60
|
-
- spec/fixtures/
|
61
|
-
- spec/fixtures/suites/fancy_workflow/verify-creds.js
|
59
|
+
- spec/fixtures/regressions/stay_unbroken/stay_unbroken_qlive.rb
|
60
|
+
- spec/fixtures/regressions/stay_unbroken/test-never-again.js
|
62
61
|
- spec/qlive/rack_spec.rb
|
63
62
|
- spec/qlive/registry_spec.rb
|
64
63
|
- spec/qlive/suite_spec.rb
|
@@ -89,10 +88,12 @@ signing_key:
|
|
89
88
|
specification_version: 3
|
90
89
|
summary: run qunit tests against actual back-end server with prepared test fixtures
|
91
90
|
test_files:
|
91
|
+
- spec/fixtures/fancy_workflow/fancy_workflow_qlive.rb
|
92
|
+
- spec/fixtures/fancy_workflow/post-new-recipe.js
|
93
|
+
- spec/fixtures/fancy_workflow/verify-creds.js
|
92
94
|
- spec/fixtures/qunit_support/start-qunit.js
|
93
|
-
- spec/fixtures/
|
94
|
-
- spec/fixtures/
|
95
|
-
- spec/fixtures/suites/fancy_workflow/verify-creds.js
|
95
|
+
- spec/fixtures/regressions/stay_unbroken/stay_unbroken_qlive.rb
|
96
|
+
- spec/fixtures/regressions/stay_unbroken/test-never-again.js
|
96
97
|
- spec/qlive/rack_spec.rb
|
97
98
|
- spec/qlive/registry_spec.rb
|
98
99
|
- spec/qlive/suite_spec.rb
|
data/.gitignore
DELETED
data/lib/qlive/.DS_Store
DELETED
Binary file
|
data/spec/.DS_Store
DELETED
Binary file
|