├── .autotest ├── .gemtest ├── .gitignore ├── .travis.yml ├── CHANGELOG.rdoc ├── Gemfile ├── LICENSE ├── Manifest.txt ├── README.rdoc ├── Rakefile ├── gemfiles ├── rails-5.0.gemfile ├── rails-5.1.gemfile └── rails-5.2.gemfile ├── lib ├── generators │ └── minitest │ │ └── feature │ │ ├── feature_generator.rb │ │ └── templates │ │ ├── feature_spec.rb │ │ └── feature_test.rb ├── minitest-rails-capybara.rb └── minitest │ └── rails │ └── capybara.rb ├── minitest-rails-capybara.gemspec ├── tasks └── test.rake └── test ├── rails_helper.rb ├── test_assertions_expectation.rb ├── test_dsl.rb ├── test_sanity.rb ├── test_spec.rb └── test_spec_type.rb /.autotest: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | 3 | require 'autotest/restart' 4 | 5 | # Autotest.add_hook :initialize do |at| 6 | # at.extra_files << "../some/external/dependency.rb" 7 | # 8 | # at.libs << ":../some/external" 9 | # 10 | # at.add_exception 'vendor' 11 | # 12 | # at.add_mapping(/dependency.rb/) do |f, _| 13 | # at.files_matching(/test_.*rb$/) 14 | # end 15 | # 16 | # %w(TestA TestB).each do |klass| 17 | # at.extra_class_map[klass] = "test/test_misc.rb" 18 | # end 19 | # end 20 | 21 | # Autotest.add_hook :run_command do |at| 22 | # system "rake build" 23 | # end 24 | -------------------------------------------------------------------------------- /.gemtest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blowmage/minitest-rails-capybara/b2664ae1290f194f1e547342c6f0012a4859e717/.gemtest -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | doc 2 | pkg 3 | log 4 | tmp 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | before_install: 3 | - gem update --system 4 | - gem --version 5 | language: ruby 6 | notifications: 7 | email: 8 | - mike@blowmage.com 9 | rvm: 10 | - 2.6.3 11 | - 2.6.0 12 | - 2.5.5 13 | - 2.5.0 14 | - 2.4.6 15 | - 2.4.0 16 | - 2.3.8 17 | - 2.3.0 18 | gemfile: 19 | - gemfiles/rails-5.2.gemfile 20 | - gemfiles/rails-5.1.gemfile 21 | - gemfiles/rails-5.0.gemfile 22 | script: "bundle exec rake test" 23 | -------------------------------------------------------------------------------- /CHANGELOG.rdoc: -------------------------------------------------------------------------------- 1 | === 3.0.2 / 2019-09-10 2 | 3 | * Allow Capybara 3 (@iloveitaly) 4 | 5 | https://github.com/blowmage/minitest-rails-capybara/compare/v3.0.1...v3.0.2 6 | 7 | === 3.0.1 / 2017-03-09 8 | 9 | * Fix bug in spec configuration, tests should use the spec DSL by default now. 10 | 11 | https://github.com/blowmage/minitest-rails-capybara/compare/v3.0.0...v3.0.1 12 | 13 | === 3.0.0 / 2016-07-01 14 | 15 | * Support Rails 5 16 | 17 | * The spec DSL is now default. 18 | 19 | https://github.com/blowmage/minitest-rails-capybara/compare/v2.1.1...v3.0.0 20 | 21 | === 2.1.1 / 2014-07-08 22 | 23 | * Fix bug with Capybara's DSL 24 | 25 | https://github.com/blowmage/minitest-rails-capybara/compare/v2.1.0...v2.1.1 26 | 27 | === 2.1.0 / 2014-07-08 28 | 29 | * Allow use of additional_spec in Minitest's Spec DSL. 30 | 31 | https://github.com/blowmage/minitest-rails-capybara/compare/v2.0.1...v2.1.0 32 | 33 | === 2.0.1 / 2014-06-14 34 | 35 | * Update dependencies on minitest-capybara and capybara 36 | 37 | https://github.com/blowmage/minitest-rails-capybara/compare/v2.0.0...v2.0.1 38 | 39 | === 2.0.0 / 2014-04-21 40 | 41 | Major release, specific to Rails 4.1+ and Minitest 5. 42 | 43 | * Support additional descriptions in spec types 44 | * describe "Users can do things", :capybara do 45 | 46 | https://github.com/blowmage/minitest-rails-capybara/compare/v1.0.0...v2.0.0 47 | 48 | === 1.0.0 / 2014-04-15 49 | 50 | * Fix issue with routes named "test" 51 | * Remove deprecation warnings 52 | 53 | https://github.com/blowmage/minitest-rails-capybara/compare/v0.10...v1.0.0 54 | 55 | === 0.10.0 / 2013-07-23 56 | 57 | * Allow feature to work without "Feature Test" 58 | * Call reset_sessions! after tests [closes #7] 59 | * Add Capybara documentation 60 | 61 | https://github.com/blowmage/minitest-rails-capybara/compare/v0.9...v0.10 62 | 63 | === 0.9.0 / 2013-03-18 64 | 65 | * Add minitest-metadata dependency 66 | * Move capybara spec into TestCase 67 | * Add instructions for running tests 68 | * Update install instructions 69 | 70 | https://github.com/blowmage/minitest-rails-capybara/compare/v0.5.1...v0.9 71 | 72 | === 0.5.1 / 2013-01-11 73 | 74 | * Add the Capybara spec DSL 75 | 76 | https://github.com/blowmage/minitest-rails-capybara/compare/v0.5...v0.5.1 77 | 78 | === 0.5 / 2013-01-11 79 | 80 | * Create Capybara::Rails::TestCase 81 | * Add feature generator 82 | 83 | https://github.com/blowmage/minitest-rails-capybara/compare/v0.1...v0.5 84 | 85 | === 0.1 / 2012-08-02 86 | 87 | * Defer to minitest-capybara for Capybara integration 88 | * Add support for Capybara matchers using minitest-matchers 89 | 90 | https://github.com/blowmage/minitest-rails-capybara/compare/v0.0.2...v0.1 91 | 92 | === 0.0.2 / 2012-07-09 93 | 94 | * Correct loading issue 95 | 96 | https://github.com/blowmage/minitest-rails-capybara/compare/v0.0.1...v0.0.2 97 | 98 | === 0.0.1 / 2012-07-07 99 | 100 | * 1 major enhancement 101 | 102 | * Birthday! 103 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gemspec 4 | 5 | gem "rails", "~> 5.0" 6 | gem "sqlite3" 7 | gem "rake" 8 | 9 | gem "hoe-git", "~> 1.0" 10 | gem "hoe-gemspec", "~> 1.0" 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Mike Moore 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Manifest.txt: -------------------------------------------------------------------------------- 1 | .autotest 2 | .gemtest 3 | .travis.yml 4 | CHANGELOG.rdoc 5 | Gemfile 6 | LICENSE 7 | Manifest.txt 8 | README.rdoc 9 | Rakefile 10 | lib/generators/minitest/feature/feature_generator.rb 11 | lib/generators/minitest/feature/templates/feature_spec.rb 12 | lib/generators/minitest/feature/templates/feature_test.rb 13 | lib/minitest-rails-capybara.rb 14 | lib/minitest/rails/capybara.rb 15 | minitest-rails-capybara.gemspec 16 | tasks/test.rake 17 | test/rails_helper.rb 18 | test/test_assertions_expectation.rb 19 | test/test_dsl.rb 20 | test/test_sanity.rb 21 | test/test_spec.rb 22 | test/test_spec_type.rb 23 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = minitest-rails-capybara 2 | 3 | Capybara integration for Minitest and Rails. 4 | 5 | {Build Status}[http://travis-ci.org/blowmage/minitest-rails-capybara] 6 | {}[https://codeclimate.com/github/blowmage/minitest-rails-capybara] 7 | 8 | == Install 9 | 10 | gem install minitest-rails-capybara 11 | 12 | This installs the following gems: 13 | 14 | minitest 15 | minitest-rails 16 | minitest-capybara 17 | capybara 18 | 19 | == Configure 20 | 21 | Follow the instructions to configure minitest-rails. Then add minitest-rails-capybara to the :test group in Gemfile: 22 | 23 | gem "minitest-rails" 24 | 25 | group :test do 26 | gem "minitest-rails-capybara" 27 | end 28 | 29 | Add the following to your test_helper.rb file to the test directory. 30 | 31 | require "minitest/rails/capybara" 32 | 33 | == Usage 34 | 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 Capybara::Rails::TestCase for your feature tests. 36 | 37 | To generate these feature tests, you can use the feature generator: 38 | 39 | rails generate minitest:feature CanAccessHome 40 | 41 | You can now use Capybara in your feature tests! 42 | 43 | require "test_helper" 44 | 45 | feature "Can Access Home" do 46 | scenario "has content" do 47 | visit root_path 48 | page.must_have_content "Home#index" 49 | end 50 | end 51 | 52 | Or you can opt-out of the Capybara's spec DSL by providing the --no-spec option: 53 | 54 | rails generate minitest:feature CanAccessHome --no-spec 55 | 56 | which will generate a feature test without using the Capybara spec DSL: 57 | 58 | require "test_helper" 59 | 60 | class CanAccessHomeTest < Capybara::Rails::TestCase 61 | def test_homepage_has_content 62 | visit root_path 63 | assert page.has_content?("Home#index") 64 | end 65 | end 66 | 67 | An alternative way to specify using Capybara is to provide :capybara as a second argument to describe: 68 | 69 | require "test_helper" 70 | 71 | describe "Can Access Home", :capybara do 72 | it "has content" do 73 | visit root_path 74 | page.must_have_content "Home#index" 75 | end 76 | end 77 | 78 | While not recommended, you can add Capybara to your integration tests. To do this add the following to your test_helper.rb file: 79 | 80 | class ActionDispatch::IntegrationTest 81 | include Capybara::DSL 82 | include Capybara::Assertions 83 | end 84 | 85 | == Specifying drivers 86 | 87 | Tests can specify drivers by setting the metadata. 88 | 89 | feature "Can Access Home" do 90 | scenario "has content", js: true do 91 | visit root_path # Visited with JavaScript driver 92 | page.must_have_content "Home#index" 93 | end 94 | end 95 | 96 | For more information, see the minitest-metadata library: 97 | 98 | https://github.com/wojtekmach/minitest-metadata 99 | 100 | == Running Tests 101 | 102 | To run your tests use the rails test that ship with rails. 103 | 104 | == Get Involved 105 | 106 | Join the mailing list to get help or offer suggestions. 107 | 108 | https://groups.google.com/group/minitest-rails 109 | 110 | == License 111 | 112 | Copyright (c) 2014 Mike Moore 113 | 114 | Permission is hereby granted, free of charge, to any person obtaining 115 | a copy of this software and associated documentation files (the 116 | "Software"), to deal in the Software without restriction, including 117 | without limitation the rights to use, copy, modify, merge, publish, 118 | distribute, sublicense, and/or sell copies of the Software, and to 119 | permit persons to whom the Software is furnished to do so, subject to 120 | the following conditions: 121 | 122 | The above copyright notice and this permission notice shall be 123 | included in all copies or substantial portions of the Software. 124 | 125 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 126 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 127 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 128 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 129 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 130 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 131 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 132 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | 3 | require "rubygems" 4 | require "hoe" 5 | 6 | Hoe.plugin :git 7 | Hoe.plugin :gemspec 8 | 9 | Hoe.spec "minitest-rails-capybara" do 10 | developer "Mike Moore", "mike@blowmage.com" 11 | 12 | self.summary = "Capybara integration for Minitest and Rails" 13 | self.description = "Adds Capybara feature tests in Minitest and Rails." 14 | self.urls = ["http://blowmage.com/minitest-rails-capybara"] 15 | 16 | self.history_file = "CHANGELOG.rdoc" 17 | self.readme_file = "README.rdoc" 18 | self.testlib = :minitest 19 | 20 | license "MIT" 21 | 22 | dependency "minitest-rails", "~> 3.0" 23 | dependency "capybara", [">= 2.7", "<= 4"] 24 | dependency "minitest-capybara", "~> 0.8" 25 | dependency "minitest-metadata", "~> 0.6" 26 | end 27 | 28 | Dir["tasks/**/*.rake"].each { |t| load t } 29 | 30 | # vim: syntax=ruby 31 | -------------------------------------------------------------------------------- /gemfiles/rails-5.0.gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" do 2 | gemspec path: ".." 3 | 4 | gem "rails", "~> 5.0.0" 5 | gem "sqlite3" 6 | gem "rake" 7 | 8 | gem "hoe-git", "~> 1.0" 9 | gem "hoe-gemspec", "~> 1.0" 10 | end 11 | -------------------------------------------------------------------------------- /gemfiles/rails-5.1.gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" do 2 | gemspec path: ".." 3 | 4 | gem "rails", "~> 5.1.0" 5 | gem "sqlite3" 6 | gem "rake" 7 | 8 | gem "hoe-git", "~> 1.0" 9 | gem "hoe-gemspec", "~> 1.0" 10 | end 11 | -------------------------------------------------------------------------------- /gemfiles/rails-5.2.gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" do 2 | gemspec path: ".." 3 | 4 | gem "rails", "~> 5.2.0" 5 | gem "sqlite3" 6 | gem "rake" 7 | 8 | gem "hoe-git", "~> 1.0" 9 | gem "hoe-gemspec", "~> 1.0" 10 | end 11 | -------------------------------------------------------------------------------- /lib/generators/minitest/feature/feature_generator.rb: -------------------------------------------------------------------------------- 1 | require "minitest-rails" 2 | require "generators/minitest" 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: true, 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 26 | -------------------------------------------------------------------------------- /lib/generators/minitest/feature/templates/feature_spec.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | feature "<%= class_name %>" do 4 | # scenario "the test is sound" do 5 | # visit root_path 6 | # page.must_have_content "Hello World" 7 | # page.wont_have_content "Goodbye All!" 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /lib/generators/minitest/feature/templates/feature_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class <%= class_name %>Test < Capybara::Rails::TestCase 4 | # test "sanity" do 5 | # visit root_path 6 | # assert_content page, "Hello World" 7 | # refute_content page, "Goodbye All!" 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /lib/minitest-rails-capybara.rb: -------------------------------------------------------------------------------- 1 | require "minitest-rails" 2 | 3 | module Minitest 4 | module Rails 5 | module Capybara 6 | VERSION = "3.0.2" 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/minitest/rails/capybara.rb: -------------------------------------------------------------------------------- 1 | require "minitest/rails" 2 | # Load minitest-capybara and minitest-matchers 3 | require "minitest-capybara" 4 | require "capybara/rails" 5 | require "minitest/metadata" 6 | 7 | module Capybara 8 | module Rails 9 | class Helpers # :nodoc: 10 | include ::Rails.application.routes.url_helpers 11 | include ::Rails.application.routes.mounted_helpers if ::Rails.application.routes.respond_to? :mounted_helpers 12 | def initialize 13 | self.default_url_options = ::Rails.application.routes.default_url_options 14 | self.default_url_options[:host] ||= "test.local" 15 | end 16 | end 17 | class TestCase < ::ActiveSupport::TestCase 18 | include Capybara::DSL 19 | include Capybara::Assertions 20 | include Minitest::Metadata 21 | 22 | # Register by name 23 | register_spec_type(/(Feature|Browser)( ?Test)?\z/i, self) 24 | register_spec_type(self) do |desc, *addl| 25 | addl.include? :capybara 26 | end 27 | 28 | # Enable Capybara's spec DSL 29 | class << self 30 | alias :background :before 31 | alias :scenario :it 32 | alias :given :let 33 | end 34 | 35 | # Configure the driver using metadata 36 | before do 37 | if metadata[:js] == true 38 | Capybara.current_driver = Capybara.javascript_driver 39 | end 40 | end 41 | 42 | after do 43 | Capybara.reset_sessions! 44 | Capybara.use_default_driver 45 | end 46 | 47 | # Defer rails helpers methods to a different object 48 | def __rails_helpers__ # :nodoc: 49 | @__rails_helpers__ ||= ::Capybara::Rails::Helpers.new 50 | end 51 | def respond_to?(method, include_private = false) # :nodoc: 52 | __rails_helpers__.respond_to?(method, include_private) || super 53 | end 54 | def method_missing(sym, *args, &block) # :nodoc: 55 | if __rails_helpers__.respond_to?(sym, true) 56 | __rails_helpers__.__send__(sym, *args, &block) 57 | else 58 | super 59 | end 60 | end 61 | end 62 | end 63 | end 64 | 65 | module Kernel # :nodoc: 66 | def feature desc, &blk 67 | describe "#{desc} Feature Test", &blk 68 | end 69 | end 70 | 71 | module Capybara 72 | module Assertions 73 | ## 74 | # Assertion that there is button 75 | # 76 | # see Capybara::Assertions#refute_button 77 | # see Capybara::Assertions#assert_no_button 78 | # see Capybara::expectations#must_have_button 79 | # see Capybara::expectations#wont_have_button 80 | # :method: assert_button 81 | 82 | ## 83 | # Assertion that there is no button 84 | # 85 | # see Capybara::Assertions#assert_button 86 | # see Capybara::expectations#must_have_button 87 | # see Capybara::expectations#wont_have_button 88 | # :method: refute_button 89 | # :alias: assert_no_button 90 | 91 | 92 | ## 93 | # Assertion that there is checked_field 94 | # 95 | # see Capybara::Assertions#refute_checked_field 96 | # see Capybara::Assertions#assert_no_checked_field 97 | # see Capybara::expectations#must_have_checked_field 98 | # see Capybara::expectations#wont_have_checked_field 99 | # :method: assert_checked_field 100 | 101 | ## 102 | # Assertion that there is no checked_field 103 | # 104 | # see Capybara::Assertions#assert_checked_field 105 | # see Capybara::expectations#must_have_checked_field 106 | # see Capybara::expectations#wont_have_checked_field 107 | # :method: refute_checked_field 108 | # :alias: assert_no_checked_field 109 | 110 | 111 | ## 112 | # Assertion that there is content 113 | # 114 | # see Capybara::Assertions#refute_content 115 | # see Capybara::Assertions#assert_no_content 116 | # see Capybara::expectations#must_have_content 117 | # see Capybara::expectations#wont_have_content 118 | # :method: assert_content 119 | 120 | ## 121 | # Assertion that there is no content 122 | # 123 | # see Capybara::Assertions#assert_content 124 | # see Capybara::expectations#must_have_content 125 | # see Capybara::expectations#wont_have_content 126 | # :method: refute_content 127 | # :alias: assert_no_content 128 | 129 | 130 | ## 131 | # Assertion that there is css 132 | # 133 | # see Capybara::Assertions#refute_css 134 | # see Capybara::Assertions#assert_no_css 135 | # see Capybara::expectations#must_have_css 136 | # see Capybara::expectations#wont_have_css 137 | # :method: assert_css 138 | 139 | ## 140 | # Assertion that there is no css 141 | # 142 | # see Capybara::Assertions#assert_css 143 | # see Capybara::expectations#must_have_css 144 | # see Capybara::expectations#wont_have_css 145 | # :method: refute_css 146 | # :alias: assert_no_css 147 | 148 | 149 | ## 150 | # Assertion that there is field 151 | # 152 | # see Capybara::Assertions#refute_field 153 | # see Capybara::Assertions#assert_no_field 154 | # see Capybara::expectations#must_have_field 155 | # see Capybara::expectations#wont_have_field 156 | # :method: assert_field 157 | 158 | ## 159 | # Assertion that there is no field 160 | # 161 | # see Capybara::Assertions#assert_field 162 | # see Capybara::expectations#must_have_field 163 | # see Capybara::expectations#wont_have_field 164 | # :method: refute_field 165 | # :alias: assert_no_field 166 | 167 | 168 | ## 169 | # Assertion that there is link 170 | # 171 | # see Capybara::Assertions#refute_link 172 | # see Capybara::Assertions#assert_no_link 173 | # see Capybara::expectations#must_have_link 174 | # see Capybara::expectations#wont_have_link 175 | # :method: assert_link 176 | 177 | ## 178 | # Assertion that there is no link 179 | # 180 | # see Capybara::Assertions#assert_link 181 | # see Capybara::expectations#must_have_link 182 | # see Capybara::expectations#wont_have_link 183 | # :method: refute_link 184 | # :alias: assert_no_link 185 | 186 | 187 | ## 188 | # Assertion that there is select 189 | # 190 | # see Capybara::Assertions#refute_select 191 | # see Capybara::Assertions#assert_no_select 192 | # see Capybara::expectations#must_have_select 193 | # see Capybara::expectations#wont_have_select 194 | # :method: assert_select 195 | 196 | ## 197 | # Assertion that there is no select 198 | # 199 | # see Capybara::Assertions#assert_select 200 | # see Capybara::expectations#must_have_select 201 | # see Capybara::expectations#wont_have_select 202 | # :method: refute_select 203 | # :alias: assert_no_select 204 | 205 | 206 | ## 207 | # Assertion that there is selector 208 | # 209 | # see Capybara::Assertions#refute_selector 210 | # see Capybara::Assertions#assert_no_selector 211 | # see Capybara::expectations#must_have_selector 212 | # see Capybara::expectations#wont_have_selector 213 | # :method: assert_selector 214 | 215 | ## 216 | # Assertion that there is no selector 217 | # 218 | # see Capybara::Assertions#assert_selector 219 | # see Capybara::expectations#must_have_selector 220 | # see Capybara::expectations#wont_have_selector 221 | # :method: refute_selector 222 | # :alias: assert_no_selector 223 | 224 | 225 | ## 226 | # Assertion that there is table 227 | # 228 | # see Capybara::Assertions#refute_table 229 | # see Capybara::Assertions#assert_no_table 230 | # see Capybara::expectations#must_have_table 231 | # see Capybara::expectations#wont_have_table 232 | # :method: assert_table 233 | 234 | ## 235 | # Assertion that there is no table 236 | # 237 | # see Capybara::Assertions#assert_table 238 | # see Capybara::expectations#must_have_table 239 | # see Capybara::expectations#wont_have_table 240 | # :method: refute_table 241 | # :alias: assert_no_table 242 | 243 | 244 | ## 245 | # Assertion that there is text 246 | # 247 | # see Capybara::Assertions#refute_text 248 | # see Capybara::Assertions#assert_no_text 249 | # see Capybara::expectations#must_have_text 250 | # see Capybara::expectations#wont_have_text 251 | # :method: assert_text 252 | 253 | ## 254 | # Assertion that there is no text 255 | # 256 | # see Capybara::Assertions#assert_text 257 | # see Capybara::expectations#must_have_text 258 | # see Capybara::expectations#wont_have_text 259 | # :method: refute_text 260 | # :alias: assert_no_text 261 | 262 | 263 | ## 264 | # Assertion that there is unchecked_field 265 | # 266 | # see Capybara::Assertions#refute_unchecked_field 267 | # see Capybara::Assertions#assert_no_unchecked_field 268 | # see Capybara::expectations#must_have_unchecked_field 269 | # see Capybara::expectations#wont_have_unchecked_field 270 | # :method: assert_unchecked_field 271 | 272 | ## 273 | # Assertion that there is no unchecked_field 274 | # 275 | # see Capybara::Assertions#assert_unchecked_field 276 | # see Capybara::expectations#must_have_unchecked_field 277 | # see Capybara::expectations#wont_have_unchecked_field 278 | # :method: refute_unchecked_field 279 | # :alias: assert_no_unchecked_field 280 | 281 | 282 | ## 283 | # Assertion that there is xpath 284 | # 285 | # see Capybara::Assertions#refute_xpath 286 | # see Capybara::Assertions#assert_no_xpath 287 | # see Capybara::expectations#must_have_xpath 288 | # see Capybara::expectations#wont_have_xpath 289 | # :method: assert_xpath 290 | 291 | ## 292 | # Assertion that there is no xpath 293 | # 294 | # see Capybara::Assertions#assert_xpath 295 | # see Capybara::expectations#must_have_xpath 296 | # see Capybara::expectations#wont_have_xpath 297 | # :method: refute_xpath 298 | # :alias: assert_no_xpath 299 | end 300 | 301 | module Expectations 302 | ## 303 | # Expectation that there is button 304 | # 305 | # see Capybara::Expectations#wont_have_button 306 | # see Capybara::Assertions#assert_button 307 | # see Capybara::Assertions#refute_button 308 | # see Capybara::Assertions#assert_no_button 309 | # :method: must_have_button 310 | 311 | ## 312 | # Expectation that there is no button 313 | # 314 | # see Capybara::Expectations#must_have_button 315 | # see Capybara::Assertions#assert_button 316 | # see Capybara::Assertions#refute_button 317 | # see Capybara::Assertions#assert_no_button 318 | # :method: wont_have_button 319 | 320 | 321 | ## 322 | # Expectation that there is checked_field 323 | # 324 | # see Capybara::Expectations#wont_have_checked_field 325 | # see Capybara::Assertions#assert_checked_field 326 | # see Capybara::Assertions#refute_checked_field 327 | # see Capybara::Assertions#assert_no_checked_field 328 | # :method: must_have_checked_field 329 | 330 | ## 331 | # Expectation that there is no checked_field 332 | # 333 | # see Capybara::Expectations#must_have_checked_field 334 | # see Capybara::Assertions#assert_checked_field 335 | # see Capybara::Assertions#refute_checked_field 336 | # see Capybara::Assertions#assert_no_checked_field 337 | # :method: wont_have_checked_field 338 | 339 | 340 | ## 341 | # Expectation that there is content 342 | # 343 | # see Capybara::Expectations#wont_have_content 344 | # see Capybara::Assertions#assert_content 345 | # see Capybara::Assertions#refute_content 346 | # see Capybara::Assertions#assert_no_content 347 | # :method: must_have_content 348 | 349 | ## 350 | # Expectation that there is no content 351 | # 352 | # see Capybara::Expectations#must_have_content 353 | # see Capybara::Assertions#assert_content 354 | # see Capybara::Assertions#refute_content 355 | # see Capybara::Assertions#assert_no_content 356 | # :method: wont_have_content 357 | 358 | 359 | ## 360 | # Expectation that there is css 361 | # 362 | # see Capybara::Expectations#wont_have_css 363 | # see Capybara::Assertions#assert_css 364 | # see Capybara::Assertions#refute_css 365 | # see Capybara::Assertions#assert_no_css 366 | # :method: must_have_css 367 | 368 | ## 369 | # Expectation that there is no css 370 | # 371 | # see Capybara::Expectations#must_have_css 372 | # see Capybara::Assertions#assert_css 373 | # see Capybara::Assertions#refute_css 374 | # see Capybara::Assertions#assert_no_css 375 | # :method: wont_have_css 376 | 377 | 378 | ## 379 | # Expectation that there is field 380 | # 381 | # see Capybara::Expectations#wont_have_field 382 | # see Capybara::Assertions#assert_field 383 | # see Capybara::Assertions#refute_field 384 | # see Capybara::Assertions#assert_no_field 385 | # :method: must_have_field 386 | 387 | ## 388 | # Expectation that there is no field 389 | # 390 | # see Capybara::Expectations#must_have_field 391 | # see Capybara::Assertions#assert_field 392 | # see Capybara::Assertions#refute_field 393 | # see Capybara::Assertions#assert_no_field 394 | # :method: wont_have_field 395 | 396 | 397 | ## 398 | # Expectation that there is link 399 | # 400 | # see Capybara::Expectations#wont_have_link 401 | # see Capybara::Assertions#assert_link 402 | # see Capybara::Assertions#refute_link 403 | # see Capybara::Assertions#assert_no_link 404 | # :method: must_have_link 405 | 406 | ## 407 | # Expectation that there is no link 408 | # 409 | # see Capybara::Expectations#must_have_link 410 | # see Capybara::Assertions#assert_link 411 | # see Capybara::Assertions#refute_link 412 | # see Capybara::Assertions#assert_no_link 413 | # :method: wont_have_link 414 | 415 | 416 | ## 417 | # Expectation that there is select 418 | # 419 | # see Capybara::Expectations#wont_have_select 420 | # see Capybara::Assertions#assert_select 421 | # see Capybara::Assertions#refute_select 422 | # see Capybara::Assertions#assert_no_select 423 | # :method: must_have_select 424 | 425 | ## 426 | # Expectation that there is no select 427 | # 428 | # see Capybara::Expectations#must_have_select 429 | # see Capybara::Assertions#assert_select 430 | # see Capybara::Assertions#refute_select 431 | # see Capybara::Assertions#assert_no_select 432 | # :method: wont_have_select 433 | 434 | 435 | ## 436 | # Expectation that there is selector 437 | # 438 | # see Capybara::Expectations#wont_have_selector 439 | # see Capybara::Assertions#assert_selector 440 | # see Capybara::Assertions#refute_selector 441 | # see Capybara::Assertions#assert_no_selector 442 | # :method: must_have_selector 443 | 444 | ## 445 | # Expectation that there is no selector 446 | # 447 | # see Capybara::Expectations#must_have_selector 448 | # see Capybara::Assertions#assert_selector 449 | # see Capybara::Assertions#refute_selector 450 | # see Capybara::Assertions#assert_no_selector 451 | # :method: wont_have_selector 452 | 453 | 454 | ## 455 | # Expectation that there is table 456 | # 457 | # see Capybara::Expectations#wont_have_table 458 | # see Capybara::Assertions#assert_table 459 | # see Capybara::Assertions#refute_table 460 | # see Capybara::Assertions#assert_no_table 461 | # :method: must_have_table 462 | 463 | ## 464 | # Expectation that there is no table 465 | # 466 | # see Capybara::Expectations#must_have_table 467 | # see Capybara::Assertions#assert_table 468 | # see Capybara::Assertions#refute_table 469 | # see Capybara::Assertions#assert_no_table 470 | # :method: wont_have_table 471 | 472 | 473 | ## 474 | # Expectation that there is text 475 | # 476 | # see Capybara::Expectations#wont_have_text 477 | # see Capybara::Assertions#assert_text 478 | # see Capybara::Assertions#refute_text 479 | # see Capybara::Assertions#assert_no_text 480 | # :method: must_have_text 481 | 482 | ## 483 | # Expectation that there is no text 484 | # 485 | # see Capybara::Expectations#must_have_text 486 | # see Capybara::Assertions#assert_text 487 | # see Capybara::Assertions#refute_text 488 | # see Capybara::Assertions#assert_no_text 489 | # :method: wont_have_text 490 | 491 | 492 | ## 493 | # Expectation that there is unchecked_field 494 | # 495 | # see Capybara::Expectations#wont_have_unchecked_field 496 | # see Capybara::Assertions#assert_unchecked_field 497 | # see Capybara::Assertions#refute_unchecked_field 498 | # see Capybara::Assertions#assert_no_unchecked_field 499 | # :method: must_have_unchecked_field 500 | 501 | ## 502 | # Expectation that there is no unchecked_field 503 | # 504 | # see Capybara::Expectations#must_have_unchecked_field 505 | # see Capybara::Assertions#assert_unchecked_field 506 | # see Capybara::Assertions#refute_unchecked_field 507 | # see Capybara::Assertions#assert_no_unchecked_field 508 | # :method: wont_have_unchecked_field 509 | 510 | 511 | ## 512 | # Expectation that there is xpath 513 | # 514 | # see Capybara::Expectations#wont_have_xpath 515 | # see Capybara::Assertions#assert_xpath 516 | # see Capybara::Assertions#refute_xpath 517 | # see Capybara::Assertions#assert_no_xpath 518 | # :method: must_have_xpath 519 | 520 | ## 521 | # Expectation that there is no xpath 522 | # 523 | # see Capybara::Expectations#must_have_xpath 524 | # see Capybara::Assertions#assert_xpath 525 | # see Capybara::Assertions#refute_xpath 526 | # see Capybara::Assertions#assert_no_xpath 527 | # :method: wont_have_xpath 528 | end 529 | end 530 | -------------------------------------------------------------------------------- /minitest-rails-capybara.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # stub: minitest-rails-capybara 3.0.2.20190910100645 ruby lib 3 | 4 | Gem::Specification.new do |s| 5 | s.name = "minitest-rails-capybara".freeze 6 | s.version = "3.0.2.20190910100645" 7 | 8 | s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= 9 | s.require_paths = ["lib".freeze] 10 | s.authors = ["Mike Moore".freeze] 11 | s.date = "2019-09-10" 12 | s.description = "Adds Capybara feature tests in Minitest and Rails.".freeze 13 | s.email = ["mike@blowmage.com".freeze] 14 | s.extra_rdoc_files = ["CHANGELOG.rdoc".freeze, "Manifest.txt".freeze, "README.rdoc".freeze] 15 | s.files = [".autotest".freeze, ".gemtest".freeze, ".travis.yml".freeze, "CHANGELOG.rdoc".freeze, "Gemfile".freeze, "LICENSE".freeze, "Manifest.txt".freeze, "README.rdoc".freeze, "Rakefile".freeze, "gemfiles/5.0.gemfile".freeze, "gemfiles/head.gemfile".freeze, "lib/generators/minitest/feature/feature_generator.rb".freeze, "lib/generators/minitest/feature/templates/feature_spec.rb".freeze, "lib/generators/minitest/feature/templates/feature_test.rb".freeze, "lib/minitest-rails-capybara.rb".freeze, "lib/minitest/rails/capybara.rb".freeze, "minitest-rails-capybara.gemspec".freeze, "tasks/test.rake".freeze, "test/rails_helper.rb".freeze, "test/test_assertions_expectation.rb".freeze, "test/test_dsl.rb".freeze, "test/test_sanity.rb".freeze, "test/test_spec.rb".freeze, "test/test_spec_type.rb".freeze] 16 | s.homepage = "http://blowmage.com/minitest-rails-capybara".freeze 17 | s.licenses = ["MIT".freeze] 18 | s.rdoc_options = ["--main".freeze, "README.rdoc".freeze] 19 | s.rubygems_version = "3.0.3".freeze 20 | s.summary = "Capybara integration for Minitest and Rails".freeze 21 | 22 | if s.respond_to? :specification_version then 23 | s.specification_version = 4 24 | 25 | if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then 26 | s.add_runtime_dependency(%q.freeze, ["~> 3.0"]) 27 | s.add_runtime_dependency(%q.freeze, [">= 2.7", "<= 4"]) 28 | s.add_runtime_dependency(%q.freeze, ["~> 0.8"]) 29 | s.add_runtime_dependency(%q.freeze, ["~> 0.6"]) 30 | s.add_development_dependency(%q.freeze, [">= 4.0", "< 7"]) 31 | s.add_development_dependency(%q.freeze, ["~> 3.18"]) 32 | else 33 | s.add_dependency(%q.freeze, ["~> 3.0"]) 34 | s.add_dependency(%q.freeze, [">= 2.7", "<= 4"]) 35 | s.add_dependency(%q.freeze, ["~> 0.8"]) 36 | s.add_dependency(%q.freeze, ["~> 0.6"]) 37 | s.add_dependency(%q.freeze, [">= 4.0", "< 7"]) 38 | s.add_dependency(%q.freeze, ["~> 3.18"]) 39 | end 40 | else 41 | s.add_dependency(%q.freeze, ["~> 3.0"]) 42 | s.add_dependency(%q.freeze, [">= 2.7", "<= 4"]) 43 | s.add_dependency(%q.freeze, ["~> 0.8"]) 44 | s.add_dependency(%q.freeze, ["~> 0.6"]) 45 | s.add_dependency(%q.freeze, [">= 4.0", "< 7"]) 46 | s.add_dependency(%q.freeze, ["~> 3.18"]) 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /tasks/test.rake: -------------------------------------------------------------------------------- 1 | namespace :test do 2 | desc "Run tests for Rails 5.0" 3 | task "5.0" do 4 | sh "rm -f Gemfile.lock" 5 | ENV["RAILS_VERSION"] = "5.0" 6 | sh "bundle && bundle exec rake test" 7 | sh "rm -f Gemfile.lock" 8 | end 9 | 10 | desc "Run tests for Rails 5.1" 11 | task "5.1" do 12 | sh "rm -f Gemfile.lock" 13 | ENV["RAILS_VERSION"] = "5.1" 14 | sh "bundle && bundle exec rake test" 15 | sh "rm -f Gemfile.lock" 16 | end 17 | 18 | desc "Run tests for Rails 5.2" 19 | task "5.2" do 20 | sh "rm -f Gemfile.lock" 21 | ENV["RAILS_VERSION"] = "5.2" 22 | sh "bundle && bundle exec rake test" 23 | sh "rm -f Gemfile.lock" 24 | end 25 | 26 | desc "Run tests for all Rails versions" 27 | task "all" do 28 | sh "rake test:5.0" 29 | sh "rake test:5.1" 30 | sh "rake test:5.2" 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /test/rails_helper.rb: -------------------------------------------------------------------------------- 1 | require "minitest/autorun" 2 | 3 | require "action_controller" 4 | require "action_controller/railtie" 5 | 6 | class TestApp < Rails::Application 7 | config.secret_token = "821c600ece97fc4ba952d67655b4b475" 8 | config.eager_load = false 9 | initialize! 10 | routes.draw do 11 | root to: "hello#world" 12 | end 13 | end 14 | class HelloController < ActionController::Base 15 | def world 16 | render html: "TestApp 17 |

Hello World

18 | 19 |

20 | 21 | 22 | ".html_safe 23 | end 24 | end 25 | 26 | Rails.application = TestApp 27 | 28 | require "rails/test_help" 29 | require "minitest/rails/capybara" 30 | 31 | Capybara.session_name = nil 32 | Capybara.default_driver = nil 33 | Capybara.use_default_driver 34 | Capybara.app = TestApp 35 | -------------------------------------------------------------------------------- /test/test_assertions_expectation.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | describe "Capybara Assertions and Expectations Feature Test" do 4 | 5 | describe "have_content" do 6 | it "has page with content" do 7 | visit root_path 8 | assert_content page, "Hello World" 9 | refute_content page, "Goobye All!" 10 | page.must_have_content "Hello World" 11 | page.wont_have_content "Goobye All!" 12 | end 13 | end 14 | 15 | describe "have_selector" do 16 | it "has page with heading" do 17 | visit root_path 18 | assert_selector page, "h1" 19 | refute_selector page, "h3" 20 | page.must_have_selector "h1" 21 | page.wont_have_selector "h3" 22 | end 23 | end 24 | 25 | describe "have_link" do 26 | it "has a link to home" do 27 | visit root_path 28 | assert_link page, "home" 29 | refute_link page, "away" 30 | page.must_have_link "home" 31 | page.wont_have_link "away" 32 | end 33 | end 34 | 35 | describe "have_field" do 36 | it "has a button to submit" do 37 | visit root_path 38 | assert_field page, "Email Address" 39 | refute_field page, "Bank Account" 40 | page.must_have_field "Email Address" 41 | page.wont_have_field "Bank Account" 42 | end 43 | end 44 | 45 | describe "have_button" do 46 | it "has a button to login" do 47 | visit root_path 48 | assert_button page, "random button" 49 | refute_button page, "missing button" 50 | page.must_have_button "random button" 51 | page.wont_have_button "missing button" 52 | end 53 | end 54 | 55 | describe "have_checked_field" do 56 | it "has a button to submit" do 57 | visit root_path 58 | assert_checked_field page, "going" 59 | refute_checked_field page, "avoid" 60 | page.must_have_checked_field "going" 61 | page.wont_have_checked_field "avoid" 62 | end 63 | end 64 | 65 | describe "have_unchecked_field" do 66 | it "has a button to submit" do 67 | visit root_path 68 | assert_unchecked_field page, "avoid" 69 | refute_unchecked_field page, "going" 70 | page.must_have_unchecked_field "avoid" 71 | page.wont_have_unchecked_field "going" 72 | end 73 | end 74 | 75 | end 76 | -------------------------------------------------------------------------------- /test/test_dsl.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | describe "Capybara DSL Feature Test" do 4 | 5 | it "can call using_wait_time" do 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 10 | end 11 | 12 | it "can call page" do 13 | ret = "ZOMG! page called current_session!" 14 | Capybara.stub :current_session, ret do 15 | assert_equal ret, page 16 | end 17 | end 18 | 19 | it "can call using_session" do 20 | ret = "ZOMG! using_session was called!" 21 | Capybara.stub :using_session, ret do 22 | using_session(:name) 23 | end 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /test/test_sanity.rb: -------------------------------------------------------------------------------- 1 | require "minitest/autorun" 2 | require "minitest-rails-capybara" 3 | 4 | class TestMinitestRailsCapybara < Minitest::Unit::TestCase 5 | def test_sanity 6 | assert Minitest::Rails::Capybara::VERSION 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/test_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | feature "Capybara Spec DSL Feature Test" do 4 | 5 | scenario "works unnested" do 6 | assert true 7 | end 8 | 9 | feature "when nested" do 10 | scenario "works nested" do 11 | assert true 12 | end 13 | end 14 | 15 | given(:thing) { "I am a thing." } 16 | 17 | scenario "given works unnested" do 18 | assert_equal "I am a thing.", thing 19 | end 20 | 21 | feature "given nested" do 22 | 23 | given(:widget) { "I am a widget." } 24 | 25 | scenario "works nested" do 26 | assert_equal "I am a thing.", thing 27 | end 28 | 29 | scenario "widget works too" do 30 | assert_equal "I am a widget.", widget 31 | end 32 | 33 | end 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 | 47 | end 48 | -------------------------------------------------------------------------------- /test/test_spec_type.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | class TestCapybaraSpecType < Minitest::Test 4 | def assert_capybara actual 5 | assert_equal Capybara::Rails::TestCase, actual 6 | end 7 | 8 | def refute_capybara actual 9 | refute_equal Capybara::Rails::TestCase, actual 10 | end 11 | 12 | def test_spec_type_resolves_for_matching_feature_strings 13 | assert_capybara Minitest::Spec.spec_type("WidgetFeatureTest") 14 | assert_capybara Minitest::Spec.spec_type("Widget Feature Test") 15 | assert_capybara Minitest::Spec.spec_type("WidgetFeature") 16 | assert_capybara Minitest::Spec.spec_type("Widget Feature") 17 | # And is not case sensitive 18 | assert_capybara Minitest::Spec.spec_type("widgetfeaturetest") 19 | assert_capybara Minitest::Spec.spec_type("widget feature test") 20 | assert_capybara Minitest::Spec.spec_type("widgetfeature") 21 | assert_capybara Minitest::Spec.spec_type("widget feature") 22 | end 23 | 24 | def test_spec_type_wont_match_non_space_characters_feature 25 | refute_capybara Minitest::Spec.spec_type("Widget Feature\tTest") 26 | refute_capybara Minitest::Spec.spec_type("Widget Feature\rTest") 27 | refute_capybara Minitest::Spec.spec_type("Widget Feature\nTest") 28 | refute_capybara Minitest::Spec.spec_type("Widget Feature\fTest") 29 | refute_capybara Minitest::Spec.spec_type("Widget FeatureXTest") 30 | end 31 | 32 | def test_spec_type_resolves_for_matching_browser_strings 33 | assert_capybara Minitest::Spec.spec_type("WidgetBrowserTest") 34 | assert_capybara Minitest::Spec.spec_type("Widget Browser Test") 35 | assert_capybara Minitest::Spec.spec_type("WidgetBrowser") 36 | assert_capybara Minitest::Spec.spec_type("Widget Browser") 37 | # And is not case sensitive 38 | assert_capybara Minitest::Spec.spec_type("widgetbrowsertest") 39 | assert_capybara Minitest::Spec.spec_type("widget browser test") 40 | assert_capybara Minitest::Spec.spec_type("widgetbrowser") 41 | assert_capybara Minitest::Spec.spec_type("widget browser") 42 | end 43 | 44 | def test_spec_type_wont_match_non_space_characters_browser 45 | refute_capybara Minitest::Spec.spec_type("Widget Browser\tTest") 46 | refute_capybara Minitest::Spec.spec_type("Widget Browser\rTest") 47 | refute_capybara Minitest::Spec.spec_type("Widget Browser\nTest") 48 | refute_capybara Minitest::Spec.spec_type("Widget Browser\fTest") 49 | refute_capybara Minitest::Spec.spec_type("Widget BrowserXTest") 50 | end 51 | 52 | def test_spec_type_resolves_for_additional_desc_capybara 53 | refute_capybara Minitest::Spec.spec_type("Unmatched String") 54 | assert_capybara Minitest::Spec.spec_type("Unmatched String", :capybara) 55 | assert_capybara Minitest::Spec.spec_type("Unmatched String", :capybara, :other) 56 | assert_capybara Minitest::Spec.spec_type("Unmatched String", :other, :capybara) 57 | end 58 | end 59 | --------------------------------------------------------------------------------