brauser 3.1.6 → 3.1.7

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/.travis-gemfile CHANGED
@@ -8,7 +8,7 @@ source "http://rubygems.org"
8
8
 
9
9
  gemspec
10
10
 
11
- # Testing gems
11
+ # Testing
12
12
  gem "rspec", "~> 2.14.1"
13
13
  gem "rake", "~> 10.1.0"
14
14
  gem "simplecov", ">= 0.7.1"
data/.travis.yml CHANGED
@@ -7,4 +7,4 @@ rvm:
7
7
  script: bundle exec rake spec:coverage
8
8
  gemfile: .travis-gemfile
9
9
  notifications:
10
- email: false
10
+ email: false
data/Rakefile CHANGED
@@ -8,4 +8,22 @@ require "bundler/gem_tasks"
8
8
  require "rspec/core/rake_task"
9
9
 
10
10
  RSpec::Core::RakeTask.new("spec")
11
- RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }
11
+ RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }
12
+
13
+ desc "Generate the documentation"
14
+ task :docs do
15
+ system("yardoc") || raise("Failed Execution of: yardoc")
16
+ end
17
+
18
+ desc "Get the current release version"
19
+ task :version, :with_name do |_, args|
20
+ gem = Bundler::GemHelper.instance.gemspec
21
+ puts [args[:with_name] == "true" ? gem.name : nil, gem.version].compact.join("-")
22
+ end
23
+
24
+ desc "Prepare the release"
25
+ task :prerelease => ["spec:coverage", "docs"] do
26
+ ["git add -A", "git commit -am \"Version #{Bundler::GemHelper.instance.gemspec.version}\""].each do |cmd|
27
+ system(cmd) || raise("Failed Execution of: #{cmd}")
28
+ end
29
+ end
data/brauser.gemspec CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |gem|
24
24
 
25
25
  gem.required_ruby_version = ">= 1.9.3"
26
26
 
27
- gem.add_dependency("lazier", "~> 3.2.5")
27
+ gem.add_dependency("lazier", "~> 3.2.6")
28
28
  end
data/doc/Brauser.html CHANGED
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Sun Jul 14 16:06:02 2013 by
124
+ Generated on Sat Jul 20 11:04:29 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.6.2 (ruby-1.9.3).
127
127
  </div>
@@ -2572,7 +2572,7 @@ browser.is_msie_v_gt_4_1_on_windows?
2572
2572
  </div>
2573
2573
 
2574
2574
  <div id="footer">
2575
- Generated on Sun Jul 14 16:06:03 2013 by
2575
+ Generated on Sat Jul 20 11:04:30 2013 by
2576
2576
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2577
2577
  0.8.6.2 (ruby-1.9.3).
2578
2578
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 16:06:02 2013 by
119
+ Generated on Sat Jul 20 11:04:29 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -476,7 +476,7 @@
476
476
  </div>
477
477
 
478
478
  <div id="footer">
479
- Generated on Sun Jul 14 16:06:02 2013 by
479
+ Generated on Sat Jul 20 11:04:30 2013 by
480
480
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
481
481
  0.8.6.2 (ruby-1.9.3).
482
482
  </div>
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Sun Jul 14 16:06:02 2013 by
128
+ Generated on Sat Jul 20 11:04:29 2013 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.8.6.2 (ruby-1.9.3).
131
131
  </div>
@@ -520,7 +520,7 @@
520
520
  </div>
521
521
 
522
522
  <div id="footer">
523
- Generated on Sun Jul 14 16:06:02 2013 by
523
+ Generated on Sat Jul 20 11:04:29 2013 by
524
524
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
525
525
  0.8.6.2 (ruby-1.9.3).
526
526
  </div>
@@ -341,7 +341,7 @@
341
341
  </div>
342
342
 
343
343
  <div id="footer">
344
- Generated on Sun Jul 14 16:06:02 2013 by
344
+ Generated on Sat Jul 20 11:04:30 2013 by
345
345
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
346
346
  0.8.6.2 (ruby-1.9.3).
347
347
  </div>
@@ -608,7 +608,7 @@
608
608
  </div>
609
609
 
610
610
  <div id="footer">
611
- Generated on Sun Jul 14 16:06:02 2013 by
611
+ Generated on Sat Jul 20 11:04:30 2013 by
612
612
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
613
613
  0.8.6.2 (ruby-1.9.3).
614
614
  </div>
@@ -574,7 +574,7 @@
574
574
  </div>
575
575
 
576
576
  <div id="footer">
577
- Generated on Sun Jul 14 16:06:02 2013 by
577
+ Generated on Sat Jul 20 11:04:30 2013 by
578
578
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
579
579
  0.8.6.2 (ruby-1.9.3).
580
580
  </div>
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Sun Jul 14 16:06:02 2013 by
128
+ Generated on Sat Jul 20 11:04:29 2013 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.8.6.2 (ruby-1.9.3).
131
131
  </div>
@@ -761,7 +761,7 @@
761
761
  </div>
762
762
 
763
763
  <div id="footer">
764
- Generated on Sun Jul 14 16:06:02 2013 by
764
+ Generated on Sat Jul 20 11:04:29 2013 by
765
765
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
766
766
  0.8.6.2 (ruby-1.9.3).
767
767
  </div>
@@ -582,7 +582,7 @@
582
582
  </div>
583
583
 
584
584
  <div id="footer">
585
- Generated on Sun Jul 14 16:06:02 2013 by
585
+ Generated on Sat Jul 20 11:04:29 2013 by
586
586
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
587
587
  0.8.6.2 (ruby-1.9.3).
588
588
  </div>
@@ -1026,7 +1026,7 @@ This class represents a detection of the current user browser.</p>
1026
1026
  </div>
1027
1027
 
1028
1028
  <div id="footer">
1029
- Generated on Sun Jul 14 16:06:03 2013 by
1029
+ Generated on Sat Jul 20 11:04:30 2013 by
1030
1030
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1031
1031
  0.8.6.2 (ruby-1.9.3).
1032
1032
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 16:06:02 2013 by
119
+ Generated on Sat Jul 20 11:04:29 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -323,7 +323,7 @@
323
323
  </div>
324
324
 
325
325
  <div id="footer">
326
- Generated on Sun Jul 14 16:06:02 2013 by
326
+ Generated on Sat Jul 20 11:04:29 2013 by
327
327
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
328
328
  0.8.6.2 (ruby-1.9.3).
329
329
  </div>
@@ -582,7 +582,7 @@
582
582
  </div>
583
583
 
584
584
  <div id="footer">
585
- Generated on Sun Jul 14 16:06:02 2013 by
585
+ Generated on Sat Jul 20 11:04:29 2013 by
586
586
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
587
587
  0.8.6.2 (ruby-1.9.3).
588
588
  </div>
@@ -503,7 +503,7 @@ Brauser::Browser.new.is(:msie).v("&gt;= 7").on?(:windows)
503
503
  </div>
504
504
 
505
505
  <div id="footer">
506
- Generated on Sun Jul 14 16:06:02 2013 by
506
+ Generated on Sat Jul 20 11:04:30 2013 by
507
507
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
508
508
  0.8.6.2 (ruby-1.9.3).
509
509
  </div>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>6</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>7</span></pre></dd>
153
153
 
154
154
  <dt id="STRING-constant" class="">STRING =
155
155
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Sun Jul 14 16:06:02 2013 by
183
+ Generated on Sat Jul 20 11:04:30 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.6.2 (ruby-1.9.3).
186
186
  </div>
data/doc/_index.html CHANGED
@@ -295,7 +295,7 @@
295
295
  </div>
296
296
 
297
297
  <div id="footer">
298
- Generated on Sun Jul 14 16:06:02 2013 by
298
+ Generated on Sat Jul 20 11:04:29 2013 by
299
299
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
300
300
  0.8.6.2 (ruby-1.9.3).
301
301
  </div>
data/doc/file.README.html CHANGED
@@ -269,7 +269,7 @@ Brauser::Browsers.add(:languages, ::Brauser::Definition.new(:it, "Italian"))
269
269
  </div></div>
270
270
 
271
271
  <div id="footer">
272
- Generated on Sun Jul 14 16:06:02 2013 by
272
+ Generated on Sat Jul 20 11:04:29 2013 by
273
273
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
274
274
  0.8.6.2 (ruby-1.9.3).
275
275
  </div>
data/doc/index.html CHANGED
@@ -269,7 +269,7 @@ Brauser::Browsers.add(:languages, ::Brauser::Definition.new(:it, "Italian"))
269
269
  </div></div>
270
270
 
271
271
  <div id="footer">
272
- Generated on Sun Jul 14 16:06:02 2013 by
272
+ Generated on Sat Jul 20 11:04:29 2013 by
273
273
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
274
274
  0.8.6.2 (ruby-1.9.3).
275
275
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sun Jul 14 16:06:02 2013 by
106
+ Generated on Sat Jul 20 11:04:29 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.6.2 (ruby-1.9.3).
109
109
  </div>
@@ -16,7 +16,7 @@ module Brauser
16
16
  MINOR = 1
17
17
 
18
18
  # The patch version.
19
- PATCH = 6
19
+ PATCH = 7
20
20
 
21
21
  # The current version of brauser.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -46,42 +46,42 @@ describe Brauser::Browser do
46
46
 
47
47
  describe ".add_default_browsers" do
48
48
  it "should call .add many times" do
49
- ::Brauser::Browser.should_receive(:add).with(:browsers, an_instance_of(Array)).exactly(4).and_call_original
49
+ expect(::Brauser::Browser).to receive(:add).with(:browsers, an_instance_of(Array)).exactly(4).and_call_original
50
50
  ::Brauser::Browser.add_default_browsers
51
51
  end
52
52
 
53
53
  it "should return a good return code" do
54
54
  expect(::Brauser::Browser.add_default_browsers).to be_true
55
55
 
56
- ::Brauser::Browser.stub(:add).and_return(false)
56
+ allow(::Brauser::Browser).to receive(:add).and_return(false)
57
57
  expect(::Brauser::Browser.add_default_browsers).to be_false
58
58
  end
59
59
  end
60
60
 
61
61
  describe ".add_default_platforms" do
62
62
  it "should call .add" do
63
- ::Brauser::Browser.should_receive(:add).with(:platforms, an_instance_of(Array))
63
+ expect(::Brauser::Browser).to receive(:add).with(:platforms, an_instance_of(Array))
64
64
  ::Brauser::Browser.add_default_platforms
65
65
  end
66
66
 
67
67
  it "should return a good return code" do
68
68
  expect(::Brauser::Browser.add_default_platforms).to be_true
69
69
 
70
- ::Brauser::Browser.stub(:add).and_return(false)
70
+ allow(::Brauser::Browser).to receive(:add).and_return(false)
71
71
  expect(::Brauser::Browser.add_default_platforms).to be_false
72
72
  end
73
73
  end
74
74
 
75
75
  describe ".add_default_languages" do
76
76
  it "should call .add" do
77
- ::Brauser::Browser.should_receive(:add).with(:languages, an_instance_of(Array))
77
+ expect(::Brauser::Browser).to receive(:add).with(:languages, an_instance_of(Array))
78
78
  ::Brauser::Browser.add_default_languages
79
79
  end
80
80
 
81
81
  it "should return a good return code" do
82
82
  expect(::Brauser::Browser.add_default_languages).to be_true
83
83
 
84
- ::Brauser::Browser.stub(:add).and_return(false)
84
+ allow(::Brauser::Browser).to receive(:add).and_return(false)
85
85
  expect(::Brauser::Browser.add_default_languages).to be_false
86
86
  end
87
87
  end
@@ -375,7 +375,7 @@ describe Brauser::Browser do
375
375
  describe "#is" do
376
376
  it "should at first call #parse_agent" do
377
377
  browser.name = nil
378
- browser.should_receive(:parse_agent)
378
+ expect(browser).to receive(:parse_agent)
379
379
  browser.is
380
380
  end
381
381
 
@@ -394,8 +394,8 @@ describe Brauser::Browser do
394
394
  browser.version = "9.0"
395
395
  expect(browser.is(:capable)).to be_true_query
396
396
 
397
- browser.should_receive(:v?).exactly(2).and_call_original
398
- browser.should_receive(:on?).and_call_original
397
+ expect(browser).to receive(:v?).exactly(2).and_call_original
398
+ expect(browser).to receive(:on?).and_call_original
399
399
  expect(browser.is(:capable, {gte: 8})).to be_true_query
400
400
  browser.platform = :windows
401
401
 
@@ -407,7 +407,7 @@ describe Brauser::Browser do
407
407
  it "should call the query and then fetch the result" do
408
408
  browser.name = :msie
409
409
 
410
- browser.should_receive("is").exactly(2).and_call_original
410
+ expect(browser).to receive("is").exactly(2).and_call_original
411
411
 
412
412
  expect(browser.is?(:chrome)).to be_false
413
413
  expect(browser.is?(:msie)).to be_true
@@ -417,7 +417,7 @@ describe Brauser::Browser do
417
417
  describe "#v" do
418
418
  it "should at first call #parse_agent" do
419
419
  browser.version = nil
420
- browser.should_receive(:parse_agent)
420
+ expect(browser).to receive(:parse_agent)
421
421
  browser.v
422
422
  end
423
423
 
@@ -451,7 +451,7 @@ describe Brauser::Browser do
451
451
  describe "#on" do
452
452
  it "should at first call #parse_agent" do
453
453
  browser.platform = nil
454
- browser.should_receive(:parse_agent)
454
+ expect(browser).to receive(:parse_agent)
455
455
  browser.on
456
456
  end
457
457
 
@@ -467,7 +467,7 @@ describe Brauser::Browser do
467
467
  it "should call the query and then fetch the result" do
468
468
  browser.platform = :windows
469
469
 
470
- browser.should_receive("on").exactly(2).and_call_original
470
+ expect(browser).to receive("on").exactly(2).and_call_original
471
471
 
472
472
  expect(browser.on?(:osx)).to be_false
473
473
  expect(browser.on?(:windows)).to be_true
@@ -477,7 +477,7 @@ describe Brauser::Browser do
477
477
  describe "#accepts" do
478
478
  it "should at first call #parse_accept_language" do
479
479
  browser.languages = nil
480
- browser.should_receive(:parse_accept_language)
480
+ expect(browser).to receive(:parse_accept_language)
481
481
  browser.accepts
482
482
  end
483
483
 
@@ -503,7 +503,7 @@ describe Brauser::Browser do
503
503
  it "should call the query and then fetch the result" do
504
504
  browser.languages = ["it"]
505
505
 
506
- browser.should_receive("accepts").exactly(2).and_call_original
506
+ expect(browser).to receive("accepts").exactly(2).and_call_original
507
507
 
508
508
  expect(browser.accepts?("it")).to be_true
509
509
  expect(browser.accepts?("en")).to be_false
@@ -512,15 +512,15 @@ describe Brauser::Browser do
512
512
 
513
513
  describe "#initalize" do
514
514
  it "initialized definitions" do
515
- ::Brauser::Browser.should_receive(:add_default_browsers)
516
- ::Brauser::Browser.should_receive(:add_default_platforms)
517
- ::Brauser::Browser.should_receive(:add_default_languages)
515
+ expect(::Brauser::Browser).to receive(:add_default_browsers)
516
+ expect(::Brauser::Browser).to receive(:add_default_platforms)
517
+ expect(::Brauser::Browser).to receive(:add_default_languages)
518
518
  ::Brauser::Browser.new
519
519
  end
520
520
 
521
521
  it "should initialize attributes and parse them" do
522
- ::Brauser::Browser.any_instance.should_receive(:parse_agent).with("A")
523
- ::Brauser::Browser.any_instance.should_receive(:parse_accept_language).with("B")
522
+ expect_any_instance_of(::Brauser::Browser).to receive(:parse_agent).with("A")
523
+ expect_any_instance_of(::Brauser::Browser).to receive(:parse_accept_language).with("B")
524
524
 
525
525
  other = ::Brauser::Browser.new("A", "B")
526
526
  expect(other.agent).to eq("A")
@@ -536,9 +536,9 @@ describe Brauser::Browser do
536
536
  end
537
537
 
538
538
  it "calling the right method" do
539
- browser.should_receive(:is?).with("opera_mobile", {}, []).and_call_original
540
- browser.should_receive(:v?).with("< 3").and_call_original
541
- browser.should_receive(:on?).with("windows").and_call_original
539
+ expect(browser).to receive(:is?).with("opera_mobile", {}, []).and_call_original
540
+ expect(browser).to receive(:v?).with("< 3").and_call_original
541
+ expect(browser).to receive(:on?).with("windows").and_call_original
542
542
 
543
543
  expect(browser.is_opera_mobile_v_lt_3_on_windows?).to be_true
544
544
  end
@@ -552,31 +552,31 @@ describe Brauser::Browser do
552
552
  end
553
553
 
554
554
  it "correctly analyzing version" do
555
- browser.should_receive(:is?).with("opera_mobile", {}, []).at_least(1).and_call_original
555
+ expect(browser).to receive(:is?).with("opera_mobile", {}, []).at_least(1).and_call_original
556
556
 
557
- browser.should_receive(:v?).with("<= 3").and_call_original
557
+ expect(browser).to receive(:v?).with("<= 3").and_call_original
558
558
  expect(browser.is_opera_mobile_v_lte_3).to be_true
559
559
 
560
- browser.should_receive(:v?).with("< 3 && >= 3").and_call_original
560
+ expect(browser).to receive(:v?).with("< 3 && >= 3").and_call_original
561
561
  expect(browser.is_opera_mobile_v_lt_3_and_gte_3?).to be_false
562
562
 
563
- browser.should_receive(:v?).with("&& >= 3").and_call_original
563
+ expect(browser).to receive(:v?).with("&& >= 3").and_call_original
564
564
  expect(browser.is_opera_mobile_v_and_gte_3?).to be_false
565
565
 
566
- browser.should_receive(:v?).with("< 3 &&").and_call_original
566
+ expect(browser).to receive(:v?).with("< 3 &&").and_call_original
567
567
  expect(browser.is_opera_mobile_v_lt_3_and?).to be_true
568
568
 
569
- browser.should_receive(:v?).with("> 2").and_return(true)
569
+ expect(browser).to receive(:v?).with("> 2").and_return(true)
570
570
  expect(browser.is_opera_mobile_v_gt_2?).to be_true
571
571
 
572
- browser.should_receive(:v?).with("== 3.4.5alpha").and_return(false)
572
+ expect(browser).to receive(:v?).with("== 3.4.5alpha").and_return(false)
573
573
  expect(browser.is_opera_mobile_v_eq_3_4_5alpha_is_3?).to be_false
574
574
  end
575
575
 
576
576
  it "immediately invalidate a query if one of the methods is invalid" do
577
- browser.should_not_receive(:is)
578
- browser.should_not_receive(:v)
579
- browser.should_not_receive(:on)
577
+ expect(browser).not_to receive(:is)
578
+ expect(browser).not_to receive(:v)
579
+ expect(browser).not_to receive(:on)
580
580
 
581
581
  expect{ browser.is_opera_mobile_vv_lt_3_on_windows? }.to raise_error(NoMethodError)
582
582
  end
@@ -590,7 +590,7 @@ describe Brauser::Browser do
590
590
 
591
591
  describe "#to_s" do
592
592
  it "should forward to #classes" do
593
- browser.should_receive(:classes)
593
+ expect(browser).to receive(:classes)
594
594
  browser.to_s
595
595
  end
596
596
  end
@@ -7,10 +7,17 @@
7
7
  require "spec_helper"
8
8
 
9
9
  describe Brauser::Hooks::RubyOnRails do
10
+ before(:each) do
11
+ stub_const("ActionController::Base", Class.new)
12
+ allow(ActionController::Base).to receive(:helper_method)
13
+ allow_any_instance_of(ActionController::Base).to receive(:request).and_return(OpenStruct.new(headers: {}))
14
+ ActionController::Base.send(:include, Brauser::Hooks::RubyOnRails)
15
+ end
16
+
10
17
  let(:controller){::ActionController::Base.new}
11
18
 
12
19
  it "should append to ActionController::Base" do
13
- expect(::ActionController::Base.new.respond_to?(:browser)).to be_true
20
+ expect(controller.respond_to?(:browser)).to be_true
14
21
  end
15
22
 
16
23
  it "should memoize browser" do
@@ -22,42 +22,42 @@ describe Brauser::Query do
22
22
 
23
23
  describe "#is" do
24
24
  it "should call the final corresponding method and then return self" do
25
- query.should_receive(:is?).and_call_original
25
+ expect(query).to receive(:is?).and_call_original
26
26
  expect(query.is(:msie)).to be(query)
27
27
  end
28
28
  end
29
29
 
30
30
  describe "#is?" do
31
31
  it "should call the browser's corresponding method and update the result" do
32
- browser.should_receive(:is?).with(:msie, {}, []).and_call_original
32
+ expect(browser).to receive(:is?).with(:msie, {}, []).and_call_original
33
33
  expect(query.is?(:msie)).to be_false
34
34
  end
35
35
  end
36
36
 
37
37
  describe "#v" do
38
38
  it "should call the final corresponding method and then return self" do
39
- query.should_receive(:v?).and_call_original
39
+ expect(query).to receive(:v?).and_call_original
40
40
  expect(query.v(">= 9")).to be(query)
41
41
  end
42
42
  end
43
43
 
44
44
  describe "#v?" do
45
45
  it "should call the browser's corresponding method and update the result" do
46
- browser.should_receive(:v?).with(">= 9").and_call_original
46
+ expect(browser).to receive(:v?).with(">= 9").and_call_original
47
47
  expect(query.v?(">= 9")).to be_true
48
48
  end
49
49
  end
50
50
 
51
51
  describe "#on" do
52
52
  it "should call the final corresponding method and then return self" do
53
- query.should_receive(:on?).and_call_original
53
+ expect(query).to receive(:on?).and_call_original
54
54
  expect(query.on(:osx)).to be(query)
55
55
  end
56
56
  end
57
57
 
58
58
  describe "#on?" do
59
59
  it "should call the browser's corresponding method and update the result" do
60
- browser.should_receive(:on?).with(:osx).and_call_original
60
+ expect(browser).to receive(:on?).with(:osx).and_call_original
61
61
  expect(query.on?(:osx)).to be_true
62
62
  end
63
63
 
@@ -65,14 +65,14 @@ describe Brauser::Query do
65
65
 
66
66
  describe "#accepts" do
67
67
  it "should call the final corresponding method and then return self" do
68
- query.should_receive(:accepts?).and_call_original
68
+ expect(query).to receive(:accepts?).and_call_original
69
69
  expect(query.accepts("it")).to be(query)
70
70
  end
71
71
  end
72
72
 
73
73
  describe "#accepts?" do
74
74
  it "should call the browser's corresponding method and update the result" do
75
- browser.should_receive(:accepts?).with("es").and_call_original
75
+ expect(browser).to receive(:accepts?).with("es").and_call_original
76
76
  expect(query.accepts?("es")).to be_false
77
77
  end
78
78
  end
@@ -85,33 +85,33 @@ describe Brauser::Query do
85
85
  end
86
86
 
87
87
  it "should call requested methods on the browser and return a query" do
88
- browser.should_receive(:is).and_call_original
89
- browser.should_receive(:v?).and_call_original
90
- browser.should_receive(:on?).and_call_original
88
+ expect(browser).to receive(:is).and_call_original
89
+ expect(browser).to receive(:v?).and_call_original
90
+ expect(browser).to receive(:on?).and_call_original
91
91
 
92
92
  expect(browser.is(:chrome).v(">= 7").on(:osx)).to be_a(::Brauser::Query)
93
93
  end
94
94
 
95
95
  it "should call methods while result is true" do
96
- browser.should_receive(:is).and_call_original
97
- browser.should_receive(:v?).and_call_original
98
- browser.should_not_receive(:on?)
96
+ expect(browser).to receive(:is).and_call_original
97
+ expect(browser).to receive(:v?).and_call_original
98
+ expect(browser).not_to receive(:on?)
99
99
 
100
100
  expect(browser.is(:chrome).v(">= 9").on(:osx)).to be_a(::Brauser::Query)
101
101
  end
102
102
 
103
103
  it "when the last method is the question mark, it should return the evaluation to boolean" do
104
- browser.should_receive(:is).and_call_original
105
- browser.should_receive(:v?).and_call_original
106
- browser.should_receive(:on?).and_call_original
104
+ expect(browser).to receive(:is).and_call_original
105
+ expect(browser).to receive(:v?).and_call_original
106
+ expect(browser).to receive(:on?).and_call_original
107
107
 
108
108
  expect(browser.is(:chrome).v(">= 7").on?(:osx)).to be_false
109
109
  end
110
110
 
111
111
  it "should return the result when ending the query with #result" do
112
- browser.should_receive(:is).and_call_original
113
- browser.should_receive(:v?).and_call_original
114
- browser.should_not_receive(:on?)
112
+ expect(browser).to receive(:is).and_call_original
113
+ expect(browser).to receive(:v?).and_call_original
114
+ expect(browser).not_to receive(:on?)
115
115
 
116
116
  expect(browser.is(:chrome).v(">= 9").on(:osx).result).to be_false
117
117
  end
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  require "rubygems"
8
8
  require "bundler/setup"
9
- require "frameworks_helper"
10
9
  require "brauser"
11
10
 
12
11
  RSpec.configure do |config|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brauser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-14 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lazier
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.5
21
+ version: 3.2.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.5
29
+ version: 3.2.6
30
30
  description: A framework agnostic browser detection and querying helper.
31
31
  email:
32
32
  - shogun_panda@me.com
@@ -85,7 +85,6 @@ files:
85
85
  - spec/brauser/hooks_spec.rb
86
86
  - spec/brauser/query_spec.rb
87
87
  - spec/coverage_helper.rb
88
- - spec/frameworks_helper.rb
89
88
  - spec/spec_helper.rb
90
89
  homepage: http://sw.cow.tc/brauser
91
90
  licenses: []
@@ -107,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
106
  version: '0'
108
107
  segments:
109
108
  - 0
110
- hash: 3062343465693115168
109
+ hash: -2610630861643712619
111
110
  requirements: []
112
111
  rubyforge_project: brauser
113
112
  rubygems_version: 1.8.25
@@ -120,6 +119,5 @@ test_files:
120
119
  - spec/brauser/hooks_spec.rb
121
120
  - spec/brauser/query_spec.rb
122
121
  - spec/coverage_helper.rb
123
- - spec/frameworks_helper.rb
124
122
  - spec/spec_helper.rb
125
123
  has_rdoc:
@@ -1,24 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # This file is part of the brauser gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
4
- # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
5
- #
6
-
7
- require "ostruct"
8
-
9
- if !defined?(Rails) then
10
- module Rails
11
- end
12
-
13
- module ActionController
14
- class Base
15
- def request
16
- OpenStruct.new(headers: {})
17
- end
18
-
19
- def self.helper_method(_)
20
-
21
- end
22
- end
23
- end
24
- end