r_fast_r_furious 1.0.0.pre → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d77a6e32fc45fc178450380e586db627632b4a87
4
- data.tar.gz: 977a43532cb758b4a6cb7ddc69703acb3da6ccae
3
+ metadata.gz: 079294ba1e7d7c5b54a85f3ed7cf78039f682ac0
4
+ data.tar.gz: 93e3ce990ee5eb2a27f3e6fad05294395d2095af
5
5
  SHA512:
6
- metadata.gz: d1b209e550b7f40e714ca7a9a037a5e1ad9e3a17f55e49a315a1cd00e8643bb0bf125a4b61cf9779f9801bc78b6e58ed4c07643eaa351c4a605ec171b6278509
7
- data.tar.gz: c373300050093232fd25cb8702319c9bad7a303de650a2ee31934204c4e92daf1ff45e0a6943a533b476a75f8d83b889bda0eb8fee5df2f7b67f1788a36a8160
6
+ metadata.gz: fbe6c96bea961f8630fb092262e543d17ddbb9125979f1cbfe0bc6cba61488d98bdcdc3b575fdc5240406bb9fd935fe122b3ea2f9baf68251a02ec79606dd2b1
7
+ data.tar.gz: c5ac2540911c153b84edfc862ea0bc3a33934883494581116cd89db6a5f31b17745415c713ea84a76dd5a982591f3e0193512a4476cc15b1aee1751f94c9ea1c
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - jruby-19mode
4
+ - rbx-19mode
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - 2.0.0
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ require "rspec/core/rake_task"
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :test => :spec
7
+ task :default => :spec
@@ -1,3 +1,3 @@
1
1
  module RFastRFurious
2
- VERSION = "1.0.0.pre"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -7,7 +7,12 @@ module RFastRFurious
7
7
  SOURCE = "https://raw.github.com/alunny/r_fast_r_furious/master/fast.js"
8
8
  def check(string, url = SOURCE)
9
9
  uri = URI.parse(SOURCE)
10
- content = Net::HTTP.get(uri)
10
+ http = Net::HTTP.new(uri.host, uri.port)
11
+ http.use_ssl = true
12
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
+ request = Net::HTTP::Get.new(uri.request_uri)
14
+ response = http.request(request)
15
+ content = response.body
11
16
  cxt = V8::Context.new
12
17
  cxt.eval(content, "fast.js")
13
18
  cxt["r_fast_r_furious"].call(string)
@@ -22,4 +22,6 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec", ">= 2.14"
26
+ spec.add_development_dependency "webmock", ">= 1"
25
27
  end
@@ -0,0 +1,16 @@
1
+ (function (root, factory) {
2
+ if (typeof define === 'function' && define.amd) {
3
+ define(factory);
4
+ } else if (typeof exports === 'object') {
5
+ module.exports = factory();
6
+ } else {
7
+ // Browser globals (root is window)
8
+ root.r_fast_r_furious = factory();
9
+ }
10
+ }(this, function () {
11
+ var r_fast = /^((T(he)(?=.*the)|2(?=.* 2)) )?Fast (Five|(((and t\3)|\2(?=.*s$)|&(?!.*:)) Furious(( (6|7))|: Tokyo Drift)?))$/;
12
+
13
+ return function (str) {
14
+ return r_fast.test(str);
15
+ }
16
+ }));
data/spec/helper.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'r_fast_r_furious'
2
+ require 'rspec'
3
+ require 'webmock/rspec'
@@ -0,0 +1,38 @@
1
+ require 'helper'
2
+
3
+ RSpec.describe RFastRFurious do
4
+
5
+ describe ".check" do
6
+
7
+ before do
8
+ stub_request(:get, "https://raw.github.com/alunny/r_fast_r_furious/master/fast.js").
9
+ to_return(:body => File.new(File.expand_path("../fixtures/fast.js", __FILE__)))
10
+ end
11
+
12
+ AWESOME_MOVIES = [
13
+ "The Fast and the Furious",
14
+ "2 Fast 2 Furious",
15
+ "The Fast and the Furious: Tokyo Drift",
16
+ "Fast & Furious",
17
+ "Fast Five",
18
+ ]
19
+
20
+ AWESOME_MOVIES.each do |title|
21
+ it "is true for \"#{title}\"" do
22
+ expect(RFastRFurious.check(title)).to be_true
23
+ end
24
+ end
25
+
26
+ UNAWESOME_MOVIES = [
27
+ "The Sorrow and the Pity",
28
+ ]
29
+
30
+ UNAWESOME_MOVIES.each do |title|
31
+ it "is false for \"#{title}\"" do
32
+ expect(RFastRFurious.check(title)).to be_false
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r_fast_r_furious
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Carey-Smith
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '2.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '2.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '1'
55
83
  description: easily validate movie titles from the fast and the furious saga
56
84
  email:
57
85
  - tim@spork.in
@@ -60,6 +88,8 @@ extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
62
90
  - .gitignore
91
+ - .rspec
92
+ - .travis.yml
63
93
  - Gemfile
64
94
  - LICENSE
65
95
  - README.md
@@ -67,6 +97,9 @@ files:
67
97
  - lib/r_fast_r_furious.rb
68
98
  - lib/r_fast_r_furious/version.rb
69
99
  - r_fast_r_furious.gemspec
100
+ - spec/fixtures/fast.js
101
+ - spec/helper.rb
102
+ - spec/r_fast_r_furious_spec.rb
70
103
  homepage: https://github.com/halorgium/r_fast_r_furious
71
104
  licenses:
72
105
  - Public Domain
@@ -82,13 +115,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
115
  version: '0'
83
116
  required_rubygems_version: !ruby/object:Gem::Requirement
84
117
  requirements:
85
- - - '>'
118
+ - - '>='
86
119
  - !ruby/object:Gem::Version
87
- version: 1.3.1
120
+ version: '0'
88
121
  requirements: []
89
122
  rubyforge_project:
90
123
  rubygems_version: 2.0.0
91
124
  signing_key:
92
125
  specification_version: 4
93
126
  summary: sometimes you just don't have enough time to read
94
- test_files: []
127
+ test_files:
128
+ - spec/fixtures/fast.js
129
+ - spec/helper.rb
130
+ - spec/r_fast_r_furious_spec.rb