bomberman 1.0.3 → 1.0.4
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/bomberman.gemspec +1 -0
- data/lib/bomberman/version.rb +1 -1
- data/spec/lib/bomberman/profanity_spec.rb +37 -6
- data/spec/spec_helper.rb +2 -1
- metadata +18 -3
- data/.rspec +0 -1
data/bomberman.gemspec
CHANGED
data/lib/bomberman/version.rb
CHANGED
@@ -1,14 +1,45 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
3
|
describe Bomberman::Profanity do
|
5
4
|
before :all do
|
6
5
|
Bomberman.configure {}
|
7
6
|
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
describe "profantity" do
|
9
|
+
it 'returns true if Bomber server returns 1 as profantity result' do
|
10
|
+
stub_request(:get, "https://bomberman-prod.herokuapp.com/api/v1/profanity/check?corpus=profanity_text").
|
11
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Token token=change me', 'Content-Type'=>'application/json; charset=utf-8', 'User-Agent'=>'Faraday v0.8.7'}).
|
12
|
+
to_return(:status => 200, :body => "1", :headers => {'Content-Type'=>'application/json; charset=utf-8'})
|
13
|
+
Bomberman::Profanity.profane?("profanity_text").should == true
|
14
|
+
end
|
15
|
+
|
16
|
+
it "returns false if Bomberman server returns something other than 1 as profanity result" do
|
17
|
+
stub_request(:get, "https://bomberman-prod.herokuapp.com/api/v1/profanity/check?corpus=nonprofanity_text").
|
18
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Token token=change me', 'Content-Type'=>'application/json; charset=utf-8', 'User-Agent'=>'Faraday v0.8.7'}).
|
19
|
+
to_return(:status => 200, :body => "something_else", :headers => {'Content-Type'=>'application/json; charset=utf-8'})
|
20
|
+
Bomberman::Profanity.profane?("nonprofanity_text").should == false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "censor" do
|
25
|
+
it "substitutes censored texts with replacement text" do
|
26
|
+
stub_request(:get, "https://bomberman-prod.herokuapp.com/api/v1/profanity/censor?corpus=The%20quick%20brown%20fox%20jumped%20over%20the%20F-BOMBing%20lazy%20dog.&replacement_text=%23%23%23%23").
|
27
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Token token=change me', 'Content-Type'=>'application/json; charset=utf-8', 'User-Agent'=>'Faraday v0.8.7'}).
|
28
|
+
to_return(:status => 200, :body => "{\"censored_text\":\"The quick brown fox jumped over the ### lazy dog.\"}", :headers => {'Content-Type'=>'application/json; charset=utf-8'})
|
29
|
+
|
30
|
+
profane_text = "The quick brown fox jumped over the F-BOMBing lazy dog."
|
31
|
+
Bomberman::Profanity.censor(profane_text, "####").should == "The quick brown fox jumped over the ### lazy dog."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "highlight" do
|
36
|
+
it "highlights captured string" do
|
37
|
+
stub_request(:get, "https://bomberman-prod.herokuapp.com/api/v1/profanity/highlight?corpus=The%20quick%20brown%20fox%20jumped%20over%20the%20F-BOMBing%20lazy%20dog.&end_tag=%3C/blink%3E&start_tag=%3Cblink%3E").
|
38
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Token token=change me', 'Content-Type'=>'application/json; charset=utf-8', 'User-Agent'=>'Faraday v0.8.7'}).
|
39
|
+
to_return(:status => 200, :body => "{\"highlighted_text\":\"The quick brown fox jumped over the <blink>F-BOMBing</blink> lazy dog.\"}", :headers => {'Content-Type'=>'application/json; charset=utf-8'})
|
40
|
+
|
41
|
+
profane_text = "The quick brown fox jumped over the F-BOMBing lazy dog."
|
42
|
+
Bomberman::Profanity.highlight(profane_text, "<blink>", "</blink>").should == "The quick brown fox jumped over the <blink>F-BOMBing</blink> lazy dog."
|
43
|
+
end
|
13
44
|
end
|
14
|
-
end
|
45
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,9 +2,10 @@ require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
3
3
|
|
4
4
|
require 'bomberman'
|
5
|
+
require 'webmock/rspec'
|
5
6
|
|
6
7
|
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
7
8
|
|
8
9
|
RSpec.configure do |config|
|
9
|
-
|
10
|
+
config.color_enabled = true
|
10
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bomberman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
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-
|
12
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.12.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: webmock
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: Client for interacting with Bomberman HTTP API. For more information
|
63
79
|
visit http://bomberman.ikayzo.com/
|
64
80
|
email:
|
@@ -68,7 +84,6 @@ extensions: []
|
|
68
84
|
extra_rdoc_files: []
|
69
85
|
files:
|
70
86
|
- .gitignore
|
71
|
-
- .rspec
|
72
87
|
- .rvmrc
|
73
88
|
- Gemfile
|
74
89
|
- LICENSE.txt
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|