minitest-rails-capybara 0.1 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/Manifest.txt +3 -0
- data/README.rdoc +17 -7
- data/Rakefile +5 -3
- data/lib/generators/mini_test/feature/feature_generator.rb +25 -0
- data/lib/generators/mini_test/feature/templates/feature_spec.rb +10 -0
- data/lib/generators/mini_test/feature/templates/feature_test.rb +9 -0
- data/lib/minitest/rails/capybara.rb +11 -4
- data/lib/minitest-rails-capybara.rb +1 -1
- data/minitest-rails-capybara.gemspec +18 -12
- data/test/test_dsl.rb +13 -7
- data/test/test_matchers.rb +1 -1
- metadata +60 -25
data/LICENSE
CHANGED
data/Manifest.txt
CHANGED
@@ -5,6 +5,9 @@ LICENSE
|
|
5
5
|
Manifest.txt
|
6
6
|
README.rdoc
|
7
7
|
Rakefile
|
8
|
+
lib/generators/mini_test/feature/feature_generator.rb
|
9
|
+
lib/generators/mini_test/feature/templates/feature_spec.rb
|
10
|
+
lib/generators/mini_test/feature/templates/feature_test.rb
|
8
11
|
lib/minitest-rails-capybara.rb
|
9
12
|
lib/minitest/rails/capybara.rb
|
10
13
|
minitest-rails-capybara.gemspec
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= minitest-rails-capybara
|
2
2
|
|
3
|
-
Capybara integration for MiniTest
|
3
|
+
Capybara integration for MiniTest and Rails.
|
4
4
|
|
5
5
|
== Install
|
6
6
|
|
@@ -32,19 +32,21 @@ Add the following to your <tt>minitest_helper.rb</tt> file to the <tt>test</tt>
|
|
32
32
|
|
33
33
|
== Usage
|
34
34
|
|
35
|
-
|
35
|
+
Capybara is intended to be used for automating a browser to test your application's features. This is different than the integration tests that Rails provides, so you must use the <tt>Capybara::Rails::TestCase</tt> for your feature tests.
|
36
36
|
|
37
|
-
|
37
|
+
To generate these feature tests, you can use the feature generator:
|
38
|
+
|
39
|
+
rails generate mini_test:feature CanAccessHome
|
38
40
|
|
39
41
|
And you can specify use of the MiniTest::Spec DSL by providing the <tt>--spec</tt> option:
|
40
42
|
|
41
|
-
rails generate
|
43
|
+
rails generate mini_test:feature CanAccessHome --spec
|
42
44
|
|
43
45
|
You can now use Capybara in your acceptance tests!
|
44
46
|
|
45
47
|
require "minitest_helper"
|
46
48
|
|
47
|
-
class CanAccessHomeTest <
|
49
|
+
class CanAccessHomeTest < Capybara::Rails::TestCase
|
48
50
|
def test_homepage_has_content
|
49
51
|
visit root_path
|
50
52
|
assert page.has_content?("Home#index")
|
@@ -55,13 +57,21 @@ Or, using the Spec DSL:
|
|
55
57
|
|
56
58
|
require "minitest_helper"
|
57
59
|
|
58
|
-
describe "Can Access Home
|
60
|
+
describe "Can Access Home Feature Test" do
|
59
61
|
it "has content" do
|
60
62
|
visit root_path
|
61
63
|
assert page.has_content?("Home#index")
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
67
|
+
If you want Capybara within your integration tests, add the following to your <tt>minitest_helper.rb</tt> file:
|
68
|
+
|
69
|
+
class ActionDispatch::IntegrationTest
|
70
|
+
include Rails.application.routes.url_helpers
|
71
|
+
include Capybara::RSpecMatchers
|
72
|
+
include Capybara::DSL
|
73
|
+
end
|
74
|
+
|
65
75
|
== Get Involved
|
66
76
|
|
67
77
|
Join the mailing list to get help or offer suggestions.
|
@@ -70,7 +80,7 @@ https://groups.google.com/group/minitest-rails
|
|
70
80
|
|
71
81
|
== License
|
72
82
|
|
73
|
-
Copyright (c)
|
83
|
+
Copyright (c) 2013 Mike Moore
|
74
84
|
|
75
85
|
Permission is hereby granted, free of charge, to any person obtaining
|
76
86
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -10,16 +10,18 @@ Hoe.plugins.delete :rubyforge
|
|
10
10
|
Hoe.spec 'minitest-rails-capybara' do
|
11
11
|
developer 'Mike Moore', 'mike@blowmage.com'
|
12
12
|
|
13
|
-
self.summary = 'Capybara integration for MiniTest
|
14
|
-
self.description = 'Adds Capybara
|
13
|
+
self.summary = 'Capybara integration for MiniTest and Rails'
|
14
|
+
self.description = 'Adds Capybara feature tests in MiniTest and Rails.'
|
15
15
|
self.urls = ['http://blowmage.com/minitest-rails-capybara']
|
16
16
|
|
17
17
|
self.history_file = "CHANGELOG.rdoc"
|
18
18
|
self.readme_file = "README.rdoc"
|
19
19
|
self.testlib = :minitest
|
20
20
|
|
21
|
-
dependency 'minitest-rails',
|
21
|
+
dependency 'minitest-rails', '~> 0.5'
|
22
|
+
dependency 'capybara', '~> 2.0'
|
22
23
|
dependency 'minitest-capybara', '~> 0.1'
|
24
|
+
dependency 'minitest-matchers', '>= 1.2'
|
23
25
|
end
|
24
26
|
|
25
27
|
# vim: syntax=ruby
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "minitest-rails"
|
2
|
+
require "generators/mini_test"
|
3
|
+
|
4
|
+
module MiniTest
|
5
|
+
module Generators
|
6
|
+
class FeatureGenerator < Base
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@_minitest_capybara_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
10
|
+
end
|
11
|
+
|
12
|
+
class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
|
13
|
+
|
14
|
+
check_class_collision :suffix => "Test"
|
15
|
+
|
16
|
+
def create_test_files
|
17
|
+
if options[:spec]
|
18
|
+
template 'feature_spec.rb', File.join('test/features', class_path, "#{file_name}_test.rb")
|
19
|
+
else
|
20
|
+
template 'feature_test.rb', File.join('test/features', class_path, "#{file_name}_test.rb")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
|
3
|
+
# To be handled correctly by Capybara this spec must end with "Feature Test"
|
4
|
+
describe "<%= class_name %> Feature Test" do
|
5
|
+
it "sanity" do
|
6
|
+
visit root_path
|
7
|
+
page.must_have_content "Hello World"
|
8
|
+
page.wont_have_content "Goobye All!"
|
9
|
+
end
|
10
|
+
end
|
@@ -3,8 +3,15 @@ require "minitest/rails"
|
|
3
3
|
require "minitest-capybara"
|
4
4
|
require "capybara/rails"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
module Capybara
|
7
|
+
module Rails
|
8
|
+
class TestCase < ::ActiveSupport::TestCase
|
9
|
+
include ::Rails.application.routes.url_helpers
|
10
|
+
include Capybara::RSpecMatchers
|
11
|
+
include Capybara::DSL
|
12
|
+
|
13
|
+
# Register by name
|
14
|
+
register_spec_type(/(Feature|Browser)( ?Test)?\z/i, self)
|
15
|
+
end
|
16
|
+
end
|
10
17
|
end
|
@@ -2,41 +2,47 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "minitest-rails-capybara"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.5.20130110235730"
|
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 = "
|
10
|
-
s.description = "Adds Capybara
|
9
|
+
s.date = "2013-01-11"
|
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"]
|
13
|
-
s.files = [".autotest", ".gemtest", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "lib/minitest-rails-capybara.rb", "lib/minitest/rails/capybara.rb", "minitest-rails-capybara.gemspec", "test/rails_helper.rb", "test/test_dsl.rb", "test/test_matchers.rb", "test/test_sanity.rb"]
|
13
|
+
s.files = [".autotest", ".gemtest", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "lib/generators/mini_test/feature/feature_generator.rb", "lib/generators/mini_test/feature/templates/feature_spec.rb", "lib/generators/mini_test/feature/templates/feature_test.rb", "lib/minitest-rails-capybara.rb", "lib/minitest/rails/capybara.rb", "minitest-rails-capybara.gemspec", "test/rails_helper.rb", "test/test_dsl.rb", "test/test_matchers.rb", "test/test_sanity.rb"]
|
14
14
|
s.homepage = "http://blowmage.com/minitest-rails-capybara"
|
15
15
|
s.rdoc_options = ["--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = "minitest-rails-capybara"
|
18
|
-
s.rubygems_version = "1.8.
|
19
|
-
s.summary = "Capybara integration for MiniTest
|
18
|
+
s.rubygems_version = "1.8.23"
|
19
|
+
s.summary = "Capybara integration for MiniTest and Rails"
|
20
20
|
s.test_files = ["test/test_dsl.rb", "test/test_matchers.rb", "test/test_sanity.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
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.5"])
|
27
|
+
s.add_runtime_dependency(%q<capybara>, ["~> 2.0"])
|
27
28
|
s.add_runtime_dependency(%q<minitest-capybara>, ["~> 0.1"])
|
29
|
+
s.add_runtime_dependency(%q<minitest-matchers>, [">= 1.2"])
|
28
30
|
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
29
|
-
s.add_development_dependency(%q<hoe>, ["~> 3.
|
31
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.3"])
|
30
32
|
else
|
31
|
-
s.add_dependency(%q<minitest-rails>, ["~> 0.
|
33
|
+
s.add_dependency(%q<minitest-rails>, ["~> 0.5"])
|
34
|
+
s.add_dependency(%q<capybara>, ["~> 2.0"])
|
32
35
|
s.add_dependency(%q<minitest-capybara>, ["~> 0.1"])
|
36
|
+
s.add_dependency(%q<minitest-matchers>, [">= 1.2"])
|
33
37
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
34
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
38
|
+
s.add_dependency(%q<hoe>, ["~> 3.3"])
|
35
39
|
end
|
36
40
|
else
|
37
|
-
s.add_dependency(%q<minitest-rails>, ["~> 0.
|
41
|
+
s.add_dependency(%q<minitest-rails>, ["~> 0.5"])
|
42
|
+
s.add_dependency(%q<capybara>, ["~> 2.0"])
|
38
43
|
s.add_dependency(%q<minitest-capybara>, ["~> 0.1"])
|
44
|
+
s.add_dependency(%q<minitest-matchers>, [">= 1.2"])
|
39
45
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
40
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
46
|
+
s.add_dependency(%q<hoe>, ["~> 3.3"])
|
41
47
|
end
|
42
48
|
end
|
data/test/test_dsl.rb
CHANGED
@@ -1,20 +1,26 @@
|
|
1
1
|
require "rails_helper"
|
2
2
|
|
3
|
-
describe "Capybara DSL
|
3
|
+
describe "Capybara DSL Feature Test" do
|
4
4
|
|
5
5
|
it "can call using_wait_time" do
|
6
|
-
|
7
|
-
using_wait_time
|
6
|
+
ret = "ZOMG! using_wait_time was called!"
|
7
|
+
Capybara.stub :using_wait_time, ret do
|
8
|
+
assert_equal ret, using_wait_time(6)
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
it "can call page" do
|
11
|
-
|
12
|
-
|
13
|
+
ret = "ZOMG! page called current_session!"
|
14
|
+
Capybara.stub :current_session, ret do
|
15
|
+
assert_equal ret, page
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
it "can call using_session" do
|
16
|
-
|
17
|
-
using_session
|
20
|
+
ret = "ZOMG! using_session was called!"
|
21
|
+
Capybara.stub :using_session, ret do
|
22
|
+
using_session(:name)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
end
|
data/test/test_matchers.rb
CHANGED
metadata
CHANGED
@@ -1,81 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-rails-capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.1'
|
5
4
|
prerelease:
|
5
|
+
version: '0.5'
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mike Moore
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
type: :runtime
|
15
16
|
name: minitest-rails
|
16
|
-
|
17
|
+
prerelease: false
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0.5'
|
17
23
|
none: false
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
18
25
|
requirements:
|
19
26
|
- - ~>
|
20
27
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0.
|
28
|
+
version: '0.5'
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
22
31
|
type: :runtime
|
32
|
+
name: capybara
|
23
33
|
prerelease: false
|
24
34
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
35
|
requirements:
|
27
36
|
- - ~>
|
28
37
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: minitest-capybara
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
version: '2.0'
|
33
39
|
none: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
34
41
|
requirements:
|
35
42
|
- - ~>
|
36
43
|
- !ruby/object:Gem::Version
|
37
|
-
version: '0
|
44
|
+
version: '2.0'
|
45
|
+
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
38
47
|
type: :runtime
|
48
|
+
name: minitest-capybara
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.1'
|
41
55
|
none: false
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
42
57
|
requirements:
|
43
58
|
- - ~>
|
44
59
|
- !ruby/object:Gem::Version
|
45
60
|
version: '0.1'
|
61
|
+
none: false
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
48
|
-
|
63
|
+
type: :runtime
|
64
|
+
name: minitest-matchers
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.2'
|
49
71
|
none: false
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
50
73
|
requirements:
|
51
|
-
- -
|
74
|
+
- - ! '>='
|
52
75
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
76
|
+
version: '1.2'
|
77
|
+
none: false
|
78
|
+
- !ruby/object:Gem::Dependency
|
54
79
|
type: :development
|
80
|
+
name: rdoc
|
55
81
|
prerelease: false
|
56
82
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
83
|
requirements:
|
59
84
|
- - ~>
|
60
85
|
- !ruby/object:Gem::Version
|
61
86
|
version: '3.10'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: hoe
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
87
|
none: false
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
66
89
|
requirements:
|
67
90
|
- - ~>
|
68
91
|
- !ruby/object:Gem::Version
|
69
|
-
version: '3.
|
92
|
+
version: '3.10'
|
93
|
+
none: false
|
94
|
+
- !ruby/object:Gem::Dependency
|
70
95
|
type: :development
|
96
|
+
name: hoe
|
71
97
|
prerelease: false
|
72
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '3.3'
|
73
103
|
none: false
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
74
105
|
requirements:
|
75
106
|
- - ~>
|
76
107
|
- !ruby/object:Gem::Version
|
77
|
-
version: '3.
|
78
|
-
|
108
|
+
version: '3.3'
|
109
|
+
none: false
|
110
|
+
description: Adds Capybara feature tests in MiniTest and Rails.
|
79
111
|
email:
|
80
112
|
- mike@blowmage.com
|
81
113
|
executables: []
|
@@ -92,6 +124,9 @@ files:
|
|
92
124
|
- Manifest.txt
|
93
125
|
- README.rdoc
|
94
126
|
- Rakefile
|
127
|
+
- lib/generators/mini_test/feature/feature_generator.rb
|
128
|
+
- lib/generators/mini_test/feature/templates/feature_spec.rb
|
129
|
+
- lib/generators/mini_test/feature/templates/feature_test.rb
|
95
130
|
- lib/minitest-rails-capybara.rb
|
96
131
|
- lib/minitest/rails/capybara.rb
|
97
132
|
- minitest-rails-capybara.gemspec
|
@@ -108,23 +143,23 @@ rdoc_options:
|
|
108
143
|
require_paths:
|
109
144
|
- lib
|
110
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
146
|
requirements:
|
113
147
|
- - ! '>='
|
114
148
|
- !ruby/object:Gem::Version
|
115
149
|
version: '0'
|
116
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
150
|
none: false
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
152
|
requirements:
|
119
153
|
- - ! '>='
|
120
154
|
- !ruby/object:Gem::Version
|
121
155
|
version: '0'
|
156
|
+
none: false
|
122
157
|
requirements: []
|
123
158
|
rubyforge_project: minitest-rails-capybara
|
124
|
-
rubygems_version: 1.8.
|
159
|
+
rubygems_version: 1.8.23
|
125
160
|
signing_key:
|
126
161
|
specification_version: 3
|
127
|
-
summary: Capybara integration for MiniTest
|
162
|
+
summary: Capybara integration for MiniTest and Rails
|
128
163
|
test_files:
|
129
164
|
- test/test_dsl.rb
|
130
165
|
- test/test_matchers.rb
|