rao-view_helper 0.0.38.pre → 0.0.43.pre

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
  SHA256:
3
- metadata.gz: 6eaabde2a6f3e939334af263eebb25598306727fa3309c53ac4b6addffd22a79
4
- data.tar.gz: a7d6a76630f0301c17f6e54d7d8c1643925873857eb40e30ff3fc08ecf7d25b2
3
+ metadata.gz: 854a6540eeabb8211fc1dbac0aeb473b255b1c2508f80dd12f717a96f79f7b2a
4
+ data.tar.gz: 346722426a1b14ccc7d3c0fb19c07174fb6a2d43a1d3ae1739d2fd7820e31531
5
5
  SHA512:
6
- metadata.gz: 9d8a0491ddc587fde60e78e480f36451142b4dffa25a0fb7392c007fae1705d3292ce00bc9ed29acf8e25f048c481ec674ee672a9a113d7774ea47c2468fa7f3
7
- data.tar.gz: 5e99b258aaf6d3d4e7a19c235f24b937788ea555c731727ef7e9c5ee5afcc74956b7407e20c47587cdeba21a51c3f00e96c6c5331f8db59301710a7f61adbb58
6
+ metadata.gz: 3277013bcd071b09843abc1248f13cf389a6bce2e9c9b2ae001a326cd733944d157bb2d78e2a1fc005ce3c3963049db499f5146836ae64a0e3b509b3037f2dca
7
+ data.tar.gz: d87e8782e3861a5d57f14ce50fdb653ef76f38f52b75566cc317708fd5c252f58d91530854f05009bb333272d100f5f3fa8c11c088d90f02a8f0817b876937ab
@@ -30,14 +30,13 @@ module Rao
30
30
  #
31
31
  # # if you need to set things like a request on your context you can
32
32
  # # do it as follows:
33
- # let(:request) { ActionDispatch::Request.new({ "SCRIPT_NAME" => "", "PATH_INFO" => "/de" }) }
34
- #
35
- # before(:each) do
36
- # view.request = request
37
- # end
33
+ # let(:request) { ActionDispatch::Request.new({ 'rack.input' => StringIO.new, "SCRIPT_NAME" => "", "PATH_INFO" => "/de" }) }
38
34
  #
39
35
  # # this is useful when your view helper makes call like c.request.path
40
36
  #
37
+ # # You can add get params to the request:
38
+ # let(:request) { ActionDispatch::Request.new({ 'rack.input' => StringIO.new, 'QUERY_STRING' => "foo=bar" }) }
39
+ #
41
40
  # # if you need to change the default_url_options you may do so like this
42
41
  # let(:default_url_options) { { host: 'example.org' } }
43
42
  #
@@ -46,11 +45,35 @@ module Rao
46
45
  # end
47
46
  # end
48
47
  #
48
+ # Make sure to use the method name as description for your describe block.
49
+ # For example if you want to test the Blorgh::ApplicationViewHelper#render
50
+ # method in a specific context your describe block should look like this:
51
+ #
52
+ # RSpec.describe Blorgh::ApplicationViewHelper, type: :view_helper do
53
+ # # ...
54
+ #
55
+ # # correct
56
+ # context 'basic usage' do
57
+ # describe 'render' do
58
+ # it { expect(rendered).to have_xpath("//div[@id='blorgh-posts']") }
59
+ # end
60
+ # end
61
+ #
62
+ # # wrong
63
+ # describe 'render' do
64
+ # context 'basic usage' do
65
+ # it { expect(rendered).to have_xpath("//div[@id='blorgh-posts']") }
66
+ # end
67
+ # end
68
+ # end
69
+ #
49
70
  module SpecHelper
50
71
  def self.included(mod)
51
72
  mod.let(:view_paths) { ActionController::Base.view_paths }
52
73
  mod.let(:assigns) { {} }
53
- mod.let(:view) { ActionView::Base.new(view_paths, assigns) }
74
+ mod.let(:request) { ActionDispatch::Request.new({ 'rack.input' => StringIO.new }) }
75
+ mod.let(:controller) { ActionController::Base.new.tap { |c| c.request = request; c } }
76
+ mod.let(:view) { ActionView::Base.new(view_paths, assigns, controller) }
54
77
  mod.let(:view_helper) { described_class.new(view) }
55
78
  mod.let(:method_name) { |e| e.metadata[:example_group][:description].to_sym }
56
79
  mod.let(:default_url_options) { { host: 'localhost:3000' } }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rao-view_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38.pre
4
+ version: 0.0.43.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  - !ruby/object:Gem::Version
147
147
  version: 1.3.1
148
148
  requirements: []
149
- rubygems_version: 3.0.6
149
+ rubygems_version: 3.1.4
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: View Helper Objects for Ruby on Rails.