minitest-rails-capybara 0.5.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +7 -0
- data/README.rdoc +26 -3
- data/Rakefile +3 -2
- data/lib/minitest/rails/capybara.rb +20 -10
- data/lib/minitest-rails-capybara.rb +1 -1
- data/minitest-rails-capybara.gemspec +14 -11
- data/test/test_spec.rb +12 -0
- metadata +24 -8
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -18,9 +18,7 @@ This installs the following gems:
|
|
18
18
|
|
19
19
|
Follow the instructions to configure <tt>minitest-rails</tt>. Then add <tt>minitest-rails-capybara</tt> to the <tt>:test</tt> group in Gemfile:
|
20
20
|
|
21
|
-
|
22
|
-
gem "minitest-rails"
|
23
|
-
end
|
21
|
+
gem "minitest-rails"
|
24
22
|
|
25
23
|
group :test do
|
26
24
|
gem "minitest-rails-capybara"
|
@@ -72,6 +70,31 @@ If you want Capybara within your integration tests, add the following to your <t
|
|
72
70
|
include Capybara::DSL
|
73
71
|
end
|
74
72
|
|
73
|
+
== Specifying drivers
|
74
|
+
|
75
|
+
Tests can specify drivers by setting the metadata.
|
76
|
+
|
77
|
+
feature "Can Access Home Feature Test" do
|
78
|
+
scenario "has content", js: true do
|
79
|
+
visit root_path # Visited with JavaScript driver
|
80
|
+
assert page.has_content?("Home#index")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
For more information, see the minitest-metadata library:
|
85
|
+
|
86
|
+
https://github.com/wojtekmach/minitest-metadata
|
87
|
+
|
88
|
+
== Running Tests
|
89
|
+
|
90
|
+
Issue the following rake command to run your features tests:
|
91
|
+
|
92
|
+
$ rake minitests:features
|
93
|
+
|
94
|
+
Or add the following to the bottom of your Rakefile to add feature tests to the default testing task:
|
95
|
+
|
96
|
+
MiniTest::Rails::Testing.default_tasks << "features"
|
97
|
+
|
75
98
|
== Get Involved
|
76
99
|
|
77
100
|
Join the mailing list to get help or offer suggestions.
|
data/Rakefile
CHANGED
@@ -18,10 +18,11 @@ Hoe.spec 'minitest-rails-capybara' do
|
|
18
18
|
self.readme_file = "README.rdoc"
|
19
19
|
self.testlib = :minitest
|
20
20
|
|
21
|
-
dependency 'minitest-rails', '~> 0.
|
21
|
+
dependency 'minitest-rails', '~> 0.9.1'
|
22
22
|
dependency 'capybara', '~> 2.0'
|
23
23
|
dependency 'minitest-capybara', '~> 0.1'
|
24
|
-
dependency 'minitest-matchers', '
|
24
|
+
dependency 'minitest-matchers', '~> 1.2'
|
25
|
+
dependency 'minitest-metadata', '~> 0.3'
|
25
26
|
end
|
26
27
|
|
27
28
|
# vim: syntax=ruby
|
@@ -2,6 +2,7 @@ require "minitest/rails"
|
|
2
2
|
# Load minitest-matchers and fix Capybara::RSpecMatchers
|
3
3
|
require "minitest-capybara"
|
4
4
|
require "capybara/rails"
|
5
|
+
require "minitest/metadata"
|
5
6
|
|
6
7
|
module Capybara
|
7
8
|
module Rails
|
@@ -9,20 +10,29 @@ module Capybara
|
|
9
10
|
include ::Rails.application.routes.url_helpers
|
10
11
|
include Capybara::RSpecMatchers
|
11
12
|
include Capybara::DSL
|
13
|
+
include MiniTest::Metadata
|
12
14
|
|
13
15
|
# Register by name
|
14
16
|
register_spec_type(/(Feature|Browser)( ?Test)?\z/i, self)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
17
|
|
19
|
-
# Enable Capybara's spec DSL
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
# Enable Capybara's spec DSL
|
19
|
+
class << self
|
20
|
+
alias :background :before
|
21
|
+
alias :scenario :it
|
22
|
+
alias :given :let
|
23
|
+
end
|
24
|
+
|
25
|
+
# Configure the driver using metadata
|
26
|
+
before do
|
27
|
+
if metadata[:js] == true
|
28
|
+
Capybara.current_driver = Capybara.javascript_driver
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
Capybara.current_driver = Capybara.default_driver
|
34
|
+
end
|
35
|
+
end
|
26
36
|
end
|
27
37
|
end
|
28
38
|
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "minitest-rails-capybara"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.9.0.20130318234245"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Mike Moore"]
|
9
|
-
s.date = "2013-
|
9
|
+
s.date = "2013-03-19"
|
10
10
|
s.description = "Adds Capybara feature tests in MiniTest and Rails."
|
11
11
|
s.email = ["mike@blowmage.com"]
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
|
@@ -23,26 +23,29 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.add_runtime_dependency(%q<minitest-rails>, ["~> 0.
|
26
|
+
s.add_runtime_dependency(%q<minitest-rails>, ["~> 0.9.1"])
|
27
27
|
s.add_runtime_dependency(%q<capybara>, ["~> 2.0"])
|
28
28
|
s.add_runtime_dependency(%q<minitest-capybara>, ["~> 0.1"])
|
29
|
-
s.add_runtime_dependency(%q<minitest-matchers>, ["
|
29
|
+
s.add_runtime_dependency(%q<minitest-matchers>, ["~> 1.2"])
|
30
|
+
s.add_runtime_dependency(%q<minitest-metadata>, ["~> 0.3"])
|
30
31
|
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
31
|
-
s.add_development_dependency(%q<hoe>, ["~> 3.
|
32
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.5"])
|
32
33
|
else
|
33
|
-
s.add_dependency(%q<minitest-rails>, ["~> 0.
|
34
|
+
s.add_dependency(%q<minitest-rails>, ["~> 0.9.1"])
|
34
35
|
s.add_dependency(%q<capybara>, ["~> 2.0"])
|
35
36
|
s.add_dependency(%q<minitest-capybara>, ["~> 0.1"])
|
36
|
-
s.add_dependency(%q<minitest-matchers>, ["
|
37
|
+
s.add_dependency(%q<minitest-matchers>, ["~> 1.2"])
|
38
|
+
s.add_dependency(%q<minitest-metadata>, ["~> 0.3"])
|
37
39
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
38
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
40
|
+
s.add_dependency(%q<hoe>, ["~> 3.5"])
|
39
41
|
end
|
40
42
|
else
|
41
|
-
s.add_dependency(%q<minitest-rails>, ["~> 0.
|
43
|
+
s.add_dependency(%q<minitest-rails>, ["~> 0.9.1"])
|
42
44
|
s.add_dependency(%q<capybara>, ["~> 2.0"])
|
43
45
|
s.add_dependency(%q<minitest-capybara>, ["~> 0.1"])
|
44
|
-
s.add_dependency(%q<minitest-matchers>, ["
|
46
|
+
s.add_dependency(%q<minitest-matchers>, ["~> 1.2"])
|
47
|
+
s.add_dependency(%q<minitest-metadata>, ["~> 0.3"])
|
45
48
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
46
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
49
|
+
s.add_dependency(%q<hoe>, ["~> 3.5"])
|
47
50
|
end
|
48
51
|
end
|
data/test/test_spec.rb
CHANGED
@@ -32,4 +32,16 @@ feature "Capybara Spec DSL Feature Test" do
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
+
feature "metadata" do
|
36
|
+
|
37
|
+
scenario "default driver" do
|
38
|
+
assert_equal Capybara.default_driver, Capybara.current_driver
|
39
|
+
end
|
40
|
+
|
41
|
+
scenario "javascript driver", js: true do
|
42
|
+
assert_equal Capybara.javascript_driver, Capybara.current_driver
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
35
47
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: minitest-rails-capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.9.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mike Moore
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
type: :runtime
|
@@ -19,13 +19,13 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 0.9.1
|
23
23
|
none: false
|
24
24
|
requirement: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: 0.9.1
|
29
29
|
none: false
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
type: :runtime
|
@@ -65,16 +65,32 @@ dependencies:
|
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ~>
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '1.2'
|
71
71
|
none: false
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '1.2'
|
77
77
|
none: false
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
type: :runtime
|
80
|
+
name: minitest-metadata
|
81
|
+
prerelease: false
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0.3'
|
87
|
+
none: false
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0.3'
|
93
|
+
none: false
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
95
|
type: :development
|
80
96
|
name: rdoc
|
@@ -99,13 +115,13 @@ dependencies:
|
|
99
115
|
requirements:
|
100
116
|
- - ~>
|
101
117
|
- !ruby/object:Gem::Version
|
102
|
-
version: '3.
|
118
|
+
version: '3.5'
|
103
119
|
none: false
|
104
120
|
requirement: !ruby/object:Gem::Requirement
|
105
121
|
requirements:
|
106
122
|
- - ~>
|
107
123
|
- !ruby/object:Gem::Version
|
108
|
-
version: '3.
|
124
|
+
version: '3.5'
|
109
125
|
none: false
|
110
126
|
description: Adds Capybara feature tests in MiniTest and Rails.
|
111
127
|
email:
|