fakesite 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4a6737c927d755be8406368ff176f4c3cf9ce65
4
- data.tar.gz: 011fd9790e39111d23e25480368d916a7f25fcaf
3
+ metadata.gz: ce2dd53bb1b29e573f5e77944fa7552942eb4359
4
+ data.tar.gz: 2581a43826d46dc7628e23501215ef934a66290a
5
5
  SHA512:
6
- metadata.gz: 4c0ff60e11de2e4b8f4217f5ed59ff7ccff51cba69711ff0be735096121cb326f7f94f025072429d0252c33ac55d57843f3004c246dd0c61ce984db333414878
7
- data.tar.gz: 5edc5ab2dcb21a3e6138128f8266aedb74224d0684e54b786771f223b4fbbedea32d1260eed990e226b365707ec5472f6853dc68e48077ffcb3845e481ca7704
6
+ metadata.gz: 7991fc6f1921690a25e4def7be7d0fd89cb6c2b5674d32435a63c1978c279c0e0dec2e8bcc72aec1439380a9d6eba9dc4fa159aa8afb350324cf0f366950ffe7
7
+ data.tar.gz: 5a02d568a480b5f55d0f09e33fe72f5f137d262f484a8136c59a34d0de904e343e85fabdc63c4831f08f807ea3bc4610e66ee87f1d8a707830db98513e615b50
data/Rakefile CHANGED
@@ -1,25 +1,25 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'fakesite'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
- load 'rails/tasks/engine.rake'
19
-
20
-
21
- load 'rails/tasks/statistics.rake'
22
-
23
-
24
-
25
- Bundler::GemHelper.install_tasks
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'fakesite'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
@@ -1,5 +1,6 @@
1
1
  require 'uri'
2
2
  require "fakesite/engine"
3
+ require "fakesite/stub"
3
4
  require "fakesite/base"
4
5
  require "fakesite/registration"
5
6
 
@@ -35,5 +36,6 @@ module Fakesite
35
36
  return if @@initialized
36
37
  @@initialized = true
37
38
  require "fakesite/action_controller"
39
+ require "fakesite/omniauth_strategy"
38
40
  end
39
41
  end
@@ -1,14 +1,6 @@
1
1
  if defined?(::Rails::Engine)
2
2
  class ActionController::Base
3
- alias_method :orig_redirect_to, :redirect_to
4
-
5
- def redirect_to(options = {}, response_status = {})
6
- id = Fakesite.match(options)
7
- if id
8
- orig_redirect_to Fakesite::Engine.routes.url_helpers.fakesite_path(id, :url => options)
9
- else
10
- orig_redirect_to(options, response_status)
11
- end
12
- end
3
+ extend Fakesite::Stub
4
+ stub_redirect :orig_redirect_to, :redirect_to
13
5
  end
14
6
  end
@@ -0,0 +1,6 @@
1
+ if defined?(::OmniAuth::Strategy)
2
+ module OmniAuth::Strategy
3
+ extend Fakesite::Stub
4
+ stub_redirect :orig_redirect, :redirect
5
+ end
6
+ end
@@ -0,0 +1,16 @@
1
+ module Fakesite
2
+ module Stub
3
+ def stub_redirect(orig_redirect_to, redirect_to)
4
+ alias_method orig_redirect_to, redirect_to
5
+
6
+ define_method redirect_to do |*args|
7
+ id = Fakesite.match(args[0])
8
+ if id
9
+ send(orig_redirect_to, Fakesite::Engine.routes.url_helpers.fakesite_path(id, :url => args[0]))
10
+ else
11
+ send(orig_redirect_to, *args)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Fakesite
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakesite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chen Yi-Cyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-15 00:00:00.000000000 Z
11
+ date: 2015-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -118,7 +118,9 @@ files:
118
118
  - lib/fakesite/action_controller.rb
119
119
  - lib/fakesite/base.rb
120
120
  - lib/fakesite/engine.rb
121
+ - lib/fakesite/omniauth_strategy.rb
121
122
  - lib/fakesite/registration.rb
123
+ - lib/fakesite/stub.rb
122
124
  - lib/fakesite/version.rb
123
125
  homepage: https://github.com/emn178/fakesite
124
126
  licenses:
@@ -140,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
142
  version: '0'
141
143
  requirements: []
142
144
  rubyforge_project:
143
- rubygems_version: 2.4.8
145
+ rubygems_version: 2.4.5
144
146
  signing_key:
145
147
  specification_version: 4
146
148
  summary: An rails plugin that provides a fake framework to stub 3-party redirect page