capybara_minitest_spec 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +44 -0
- data/README.md +1 -1
- data/lib/capybara_minitest_spec/version.rb +1 -1
- data/spec/capybara_rspec_matchers.spec.rb +58 -21
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65c26b16230169c745419f1c9a725b8ad8e41256
|
4
|
+
data.tar.gz: 38814db2a9bace6306c5c21d362c5c06b4b05c65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a075db9aadd318f956e88b51bc074d15a71d3b653fa9f54bd7739646d2d2b15501df82b1f08b78f810ab7d3eede082180f9f023183f96580f3d790bb733adcd8
|
7
|
+
data.tar.gz: fd2e5b7cf9642db96948eaf9e552f7f4584a2aecc015abf2a73d02242ba4c65f7f24008357fec3e15659eadb24943fa6893c8e8ea6b6bed11c16f347cdbe0f89
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capybara_minitest_spec (1.0.3)
|
5
|
+
capybara (>= 2)
|
6
|
+
minitest (>= 2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
awesome_print (1.2.0)
|
12
|
+
capybara (2.4.1)
|
13
|
+
mime-types (>= 1.16)
|
14
|
+
nokogiri (>= 1.3.3)
|
15
|
+
rack (>= 1.0.0)
|
16
|
+
rack-test (>= 0.5.4)
|
17
|
+
xpath (~> 2.0)
|
18
|
+
mime-types (2.3)
|
19
|
+
mini_portile (0.6.0)
|
20
|
+
minitest (5.4.0)
|
21
|
+
nokogiri (1.6.3.1)
|
22
|
+
mini_portile (= 0.6.0)
|
23
|
+
rack (1.5.2)
|
24
|
+
rack-protection (1.5.3)
|
25
|
+
rack
|
26
|
+
rack-test (0.6.2)
|
27
|
+
rack (>= 1.0)
|
28
|
+
rake (10.3.1)
|
29
|
+
sinatra (1.4.5)
|
30
|
+
rack (~> 1.4)
|
31
|
+
rack-protection (~> 1.4)
|
32
|
+
tilt (~> 1.3, >= 1.3.4)
|
33
|
+
tilt (1.4.1)
|
34
|
+
xpath (2.0.0)
|
35
|
+
nokogiri (~> 1.3)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
awesome_print
|
42
|
+
capybara_minitest_spec!
|
43
|
+
rake
|
44
|
+
sinatra (>= 0.9.4)
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ NOTE: If after installing the Capybara gem, Nokogiri isn't installed, it's a kno
|
|
56
56
|
|
57
57
|
## Compatibility
|
58
58
|
|
59
|
-
In theory, this should work with Capybara >= 2. The latest version it was tested with was Capybara 2.1.
|
59
|
+
In theory, this should work with Capybara >= 2. The latest version it was tested with was Capybara 2.4.1.
|
60
60
|
|
61
61
|
For Capybara < 2 support, use a version of this gem < 1.0.
|
62
62
|
|
@@ -77,7 +77,6 @@ describe Capybara::RSpecMatchers do
|
|
77
77
|
"<h1>Text</h1>".must_have_css('h1', between: 2..3)
|
78
78
|
end.must_fail_with_message("expected to find css \"h1\" between 2 and 3 times, found 1 match: \"Text\"")
|
79
79
|
end
|
80
|
-
|
81
80
|
end
|
82
81
|
|
83
82
|
context "with should_not" do
|
@@ -357,20 +356,26 @@ describe Capybara::RSpecMatchers do
|
|
357
356
|
|
358
357
|
context "on a string" do
|
359
358
|
context "with should" do
|
360
|
-
it "passes if
|
359
|
+
it "passes if text contains given string" do
|
361
360
|
"<h1>Text</h1>".must_have_text('Text')
|
362
361
|
end
|
363
362
|
|
364
|
-
it "passes if
|
363
|
+
it "passes if text matches given regexp" do
|
365
364
|
"<h1>Text</h1>".must_have_text(/ext/)
|
366
365
|
end
|
367
366
|
|
368
|
-
it "fails if
|
367
|
+
it "fails if text doesn't contain given string" do
|
369
368
|
expect do
|
370
369
|
"<h1>Text</h1>".must_have_text('No such Text')
|
371
370
|
end.must_fail_with_message(/expected to find text "No such Text" in "Text"/)
|
372
371
|
end
|
373
372
|
|
373
|
+
it "fails if text doesn't match given regexp" do
|
374
|
+
expect do
|
375
|
+
"<h1>Text</h1>".must_have_text(/No such Text/)
|
376
|
+
end.must_fail_with_message('expected to find text matching /No such Text/ in "Text"')
|
377
|
+
end
|
378
|
+
|
374
379
|
it "casts Fixnum to string" do
|
375
380
|
expect do
|
376
381
|
"<h1>Text</h1>".must_have_text(3)
|
@@ -380,30 +385,30 @@ describe Capybara::RSpecMatchers do
|
|
380
385
|
it "fails if matched text count does not equal to expected count" do
|
381
386
|
expect do
|
382
387
|
"<h1>Text</h1>".must_have_text('Text', count: 2)
|
383
|
-
end.must_fail_with_message(
|
388
|
+
end.must_fail_with_message('expected to find text "Text" 2 times but found 1 time in "Text"')
|
384
389
|
end
|
385
390
|
|
386
391
|
it "fails if matched text count is less than expected minimum count" do
|
387
392
|
expect do
|
388
393
|
"<h1>Text</h1>".must_have_text('Lorem', minimum: 1)
|
389
|
-
end.must_fail_with_message(
|
394
|
+
end.must_fail_with_message('expected to find text "Lorem" at least 1 time but found 0 times in "Text"')
|
390
395
|
end
|
391
396
|
|
392
397
|
it "fails if matched text count is more than expected maximum count" do
|
393
398
|
expect do
|
394
399
|
"<h1>Text TextText</h1>".must_have_text('Text', maximum: 2)
|
395
|
-
end.must_fail_with_message(
|
400
|
+
end.must_fail_with_message('expected to find text "Text" at most 2 times but found 3 times in "Text TextText"')
|
396
401
|
end
|
397
402
|
|
398
403
|
it "fails if matched text count does not belong to expected range" do
|
399
404
|
expect do
|
400
405
|
"<h1>Text</h1>".must_have_text('Text', between: 2..3)
|
401
|
-
end.must_fail_with_message(
|
406
|
+
end.must_fail_with_message('expected to find text "Text" between 2 and 3 times but found 1 time in "Text"')
|
402
407
|
end
|
403
408
|
end
|
404
409
|
|
405
410
|
context "with should_not" do
|
406
|
-
it "passes if
|
411
|
+
it "passes if text doesn't contain a string" do
|
407
412
|
"<h1>Text</h1>".wont_have_text('No such Text')
|
408
413
|
end
|
409
414
|
|
@@ -411,7 +416,7 @@ describe Capybara::RSpecMatchers do
|
|
411
416
|
"<h1>Text</h1>".wont_have_text('.')
|
412
417
|
end
|
413
418
|
|
414
|
-
it "fails if
|
419
|
+
it "fails if text contains a string" do
|
415
420
|
expect do
|
416
421
|
"<h1>Text</h1>".wont_have_text('Text')
|
417
422
|
end.must_fail_with_message(/expected not to find text "Text" in "Text"/)
|
@@ -471,10 +476,11 @@ describe Capybara::RSpecMatchers do
|
|
471
476
|
end
|
472
477
|
end
|
473
478
|
end
|
479
|
+
|
474
480
|
end
|
475
481
|
|
476
482
|
describe "have_link matcher" do
|
477
|
-
let(:html) { '<a href="#">Just a link</a>' }
|
483
|
+
let(:html) { '<a href="#">Just a link</a><a href="#">Another link</a>' }
|
478
484
|
|
479
485
|
it "gives proper description" do
|
480
486
|
have_link('Just a link').description.must_equal "have link \"Just a link\""
|
@@ -506,23 +512,27 @@ describe Capybara::RSpecMatchers do
|
|
506
512
|
it "fails if there is no such title" do
|
507
513
|
expect do
|
508
514
|
html.must_have_title('No such title')
|
509
|
-
end.must_fail_with_message(
|
515
|
+
end.must_fail_with_message('expected "Just a title" to include "No such title"')
|
510
516
|
end
|
511
|
-
end
|
512
517
|
|
513
|
-
|
514
|
-
|
515
|
-
|
518
|
+
it "fails if title doesn't match regexp" do
|
519
|
+
expect do
|
520
|
+
html.must_have_title(/[[:upper:]]+[[:lower:]]+l{2}o/)
|
521
|
+
end.must_fail_with_message('expected "Just a title" to match /[[:upper:]]+[[:lower:]]+l{2}o/')
|
516
522
|
end
|
523
|
+
end
|
517
524
|
|
525
|
+
context "on a page or node" do
|
518
526
|
it "passes if there is such a title" do
|
527
|
+
visit('/with_js')
|
519
528
|
page.must_have_title('with_js')
|
520
529
|
end
|
521
530
|
|
522
531
|
it "fails if there is no such title" do
|
532
|
+
visit('/with_js')
|
523
533
|
expect do
|
524
534
|
page.must_have_title('No such title')
|
525
|
-
end.must_fail_with_message(
|
535
|
+
end.must_fail_with_message('expected "with_js" to include "No such title"')
|
526
536
|
end
|
527
537
|
end
|
528
538
|
end
|
@@ -546,21 +556,44 @@ describe Capybara::RSpecMatchers do
|
|
546
556
|
end
|
547
557
|
|
548
558
|
describe "have_field matcher" do
|
549
|
-
let(:html) { '<p><label>Text field<input type="text"/></label></p>' }
|
559
|
+
let(:html) { '<p><label>Text field<input type="text" value="some value"/></label></p>' }
|
550
560
|
|
551
561
|
it "gives proper description" do
|
552
562
|
have_field('Text field').description.must_equal "have field \"Text field\""
|
553
563
|
end
|
554
564
|
|
565
|
+
it "gives proper description for a given value" do
|
566
|
+
have_field('Text field', with: 'some value').description.must_equal "have field \"Text field\" with value \"some value\""
|
567
|
+
end
|
568
|
+
|
555
569
|
it "passes if there is such a field" do
|
556
570
|
html.must_have_field('Text field')
|
557
571
|
end
|
558
572
|
|
573
|
+
it "passes if there is such a field with value" do
|
574
|
+
html.must_have_field('Text field', with: 'some value')
|
575
|
+
end
|
576
|
+
|
559
577
|
it "fails if there is no such field" do
|
560
578
|
expect do
|
561
579
|
html.must_have_field('No such Field')
|
562
580
|
end.must_fail_with_message(/expected to find field "No such Field"/)
|
563
581
|
end
|
582
|
+
|
583
|
+
it "fails if there is such field but with false value" do
|
584
|
+
expect do
|
585
|
+
html.must_have_field('Text field', with: 'false value')
|
586
|
+
end.must_fail_with_message(/expected to find field "Text field"/)
|
587
|
+
end
|
588
|
+
|
589
|
+
it "treats a given value as a string" do
|
590
|
+
class Foo
|
591
|
+
def to_s
|
592
|
+
"some value"
|
593
|
+
end
|
594
|
+
end
|
595
|
+
html.must_have_field('Text field', with: Foo.new)
|
596
|
+
end
|
564
597
|
end
|
565
598
|
|
566
599
|
describe "have_checked_field matcher" do
|
@@ -570,9 +603,9 @@ describe Capybara::RSpecMatchers do
|
|
570
603
|
end
|
571
604
|
|
572
605
|
it "gives proper description" do
|
573
|
-
have_checked_field('it is checked').description.must_equal "have field \"it is checked\""
|
606
|
+
have_checked_field('it is checked').description.must_equal "have field \"it is checked\" that is checked"
|
574
607
|
end
|
575
|
-
|
608
|
+
|
576
609
|
context "with should" do
|
577
610
|
it "passes if there is such a field and it is checked" do
|
578
611
|
html.must_have_checked_field('it is checked')
|
@@ -615,7 +648,7 @@ describe Capybara::RSpecMatchers do
|
|
615
648
|
end
|
616
649
|
|
617
650
|
it "gives proper description" do
|
618
|
-
have_unchecked_field('unchecked field').description.must_equal "have field \"unchecked field\""
|
651
|
+
have_unchecked_field('unchecked field').description.must_equal "have field \"unchecked field\" that is not checked"
|
619
652
|
end
|
620
653
|
|
621
654
|
context "with should" do
|
@@ -660,6 +693,10 @@ describe Capybara::RSpecMatchers do
|
|
660
693
|
have_select('Select Box').description.must_equal "have select box \"Select Box\""
|
661
694
|
end
|
662
695
|
|
696
|
+
it "gives proper description for a given selected value" do
|
697
|
+
have_select('Select Box', selected: 'some value').description.must_equal "have select box \"Select Box\" with \"some value\" selected"
|
698
|
+
end
|
699
|
+
|
663
700
|
it "passes if there is such a select" do
|
664
701
|
html.must_have_select('Select Box')
|
665
702
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara_minitest_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Ning
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- ".ruby-version"
|
94
94
|
- ".travis.yml"
|
95
95
|
- Gemfile
|
96
|
+
- Gemfile.lock
|
96
97
|
- HISTORY.md
|
97
98
|
- LICENSE.txt
|
98
99
|
- README.md
|
@@ -125,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
126
|
version: '0'
|
126
127
|
requirements: []
|
127
128
|
rubyforge_project: capybara_minitest_spec
|
128
|
-
rubygems_version: 2.2.
|
129
|
+
rubygems_version: 2.2.2
|
129
130
|
signing_key:
|
130
131
|
specification_version: 4
|
131
132
|
summary: Capybara + MiniTest::Spec
|