gfrom 0.2.01 → 0.2.02
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/Gemfile +1 -0
- data/gfrom.gemspec +2 -1
- data/lib/gfrom.rb +1 -8
- data/spec/lib/gfrom_spec.rb +16 -14
- data/spec/spec_helper.rb +1 -2
- metadata +17 -1
data/Gemfile
CHANGED
data/gfrom.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.platform = Gem::Platform::RUBY
|
7
7
|
spec.name = "gfrom"
|
8
|
-
spec.version = "0.2.
|
8
|
+
spec.version = "0.2.02"
|
9
9
|
spec.authors = ["Marvin Marcelo"]
|
10
10
|
spec.email = ["mrclmrvn@gmail.com"]
|
11
11
|
spec.description = %q{Wrap Google Form within your site}
|
@@ -27,5 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.3"
|
28
28
|
spec.add_development_dependency "rake"
|
29
29
|
spec.add_development_dependency "rspec"
|
30
|
+
spec.add_development_dependency "webmock"
|
30
31
|
end
|
31
32
|
|
data/lib/gfrom.rb
CHANGED
@@ -15,14 +15,7 @@ class Gfrom
|
|
15
15
|
@form = Hash.new
|
16
16
|
@fields = []
|
17
17
|
|
18
|
-
|
19
|
-
uri = Addressable::URI.parse(url)
|
20
|
-
if uri.to_hash.select{|k,v| [:scheme, :host].include? k }.values.any?{|v| v.nil? || v.length == 0}
|
21
|
-
raise "Invalid URI"
|
22
|
-
end
|
23
|
-
uri.query_values ||= Hash.new
|
24
|
-
uri.query_values = uri.query_values.merge({"hl" => lang})
|
25
|
-
url = uri.to_s
|
18
|
+
url = Gfrom::locale_url(url, lang)
|
26
19
|
|
27
20
|
@cache = "#{Dir.tmpdir}/#{Digest::SHA1.hexdigest(url)}"
|
28
21
|
if File.exists?(@cache) and regenerate_cache
|
data/spec/lib/gfrom_spec.rb
CHANGED
@@ -12,20 +12,22 @@ describe Gfrom do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
context "attributes" do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
before do
|
16
|
+
@url = "https://testdocs.google.com/forms/d/1GkTDyoRCGTYXHy5kt2TDwtpr63H0b8Zyd_SWaBHwl30/viewform?hl=en"
|
17
|
+
stub_request(:get, @url).to_return(:body => File.open("spec/support/gfrom/form_default.html").read)
|
18
|
+
end
|
19
|
+
subject { Gfrom.new(@url) }
|
20
|
+
it { should respond_to(:fields) }
|
21
|
+
it { should respond_to(:form) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#submit" do
|
25
|
+
context "success" do
|
26
|
+
pending
|
27
|
+
end
|
28
|
+
context "error" do
|
29
|
+
pending
|
30
|
+
end
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
3
|
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
4
|
# loaded once.
|
5
|
-
|
5
|
+
require 'webmock/rspec'
|
6
6
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
7
|
RSpec.configure do |config|
|
8
8
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
@@ -14,5 +14,4 @@ RSpec.configure do |config|
|
|
14
14
|
# the seed, which is printed after each run.
|
15
15
|
# --seed 1234
|
16
16
|
config.order = 'random'
|
17
|
-
config.mock_with :rr
|
18
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gfrom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.02
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -123,6 +123,22 @@ dependencies:
|
|
123
123
|
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: webmock
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
126
142
|
description: Wrap Google Form within your site
|
127
143
|
email:
|
128
144
|
- mrclmrvn@gmail.com
|