foundation_rails_helper 2.0.0 → 3.0.0.beta3

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/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
2
3
  require "foundation_rails_helper"
3
4
  require "capybara"
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ require 'active_model'
3
+
4
+ class Author
5
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
6
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
7
+
8
+ def to_label
9
+ end
10
+
11
+ def persisted?
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ require 'active_model'
3
+
4
+ class Book
5
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
6
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
7
+
8
+ def to_label
9
+ end
10
+
11
+ def persisted?
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ require 'active_model'
3
+
4
+ class Genre
5
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
6
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
7
+
8
+ def to_label
9
+ end
10
+
11
+ def persisted?
12
+ end
13
+ end
@@ -1,34 +1,26 @@
1
+ # frozen_string_literal: true
1
2
  require 'bundler/setup'
2
- require 'active_support'
3
- require 'action_pack'
4
3
  require 'action_view'
5
4
  require 'action_controller'
6
- require 'action_dispatch'
7
5
  require 'active_model'
8
6
  require 'active_support/core_ext'
9
7
 
10
8
  # Thanks to Justin French for formtastic spec
11
9
  module FoundationRailsSpecHelper
12
- include ActionPack
13
- include ActionView::Context if defined?(ActionView::Context)
14
- include ActionView::RecordIdentifier
15
10
  include ActionView::Helpers::FormHelper
16
- include ActionView::Helpers::FormTagHelper
17
11
  include ActionView::Helpers::FormOptionsHelper
18
- include ActionView::Helpers::UrlHelper
19
- include ActionView::Helpers::TagHelper
20
- include ActionView::Helpers::TextHelper
21
- include ActionView::Helpers::ActiveRecordHelper if defined?(ActionView::Helpers::ActiveRecordHelper)
22
- include ActionView::Helpers::ActiveModelHelper if defined?(ActionView::Helpers::ActiveModelHelper)
23
12
  include ActionView::Helpers::DateHelper
24
- include ActionView::Helpers::CaptureHelper
25
- include ActionView::Helpers::AssetTagHelper
26
- include ActiveSupport
27
- include ActionController::PolymorphicRoutes if defined?(ActionController::PolymorphicRoutes)
28
13
  include ActionDispatch::Routing::UrlFor
14
+ # to use dom_class in Rails 4 tests
15
+ # in Rails 5, RecordIdentifier is already required by FormHelper module
16
+ include ActionView::RecordIdentifier
29
17
 
30
18
  def active_model_validator(kind, attributes, options = {})
31
- validator = mock("ActiveModel::Validations::#{kind.to_s.titlecase}Validator", attributes: attributes, options: options)
19
+ validator = mock(
20
+ "ActiveModel::Validations::#{kind.to_s.titlecase}Validator",
21
+ attributes: attributes,
22
+ options: options
23
+ )
32
24
  allow(validator).to receive(:kind).and_return(kind)
33
25
  validator
34
26
  end
@@ -49,112 +41,76 @@ module FoundationRailsSpecHelper
49
41
  active_model_validator(:numericality, attributes, options)
50
42
  end
51
43
 
52
- class ::Author
53
- extend ActiveModel::Naming if defined?(ActiveModel::Naming)
54
- include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
55
-
56
- def to_label
57
- end
58
-
59
- def persisted?
60
- end
44
+ def mock_everything
45
+ mock_author
46
+ mock_books
47
+ mock_genres
61
48
  end
62
49
 
63
- class ::Book
64
- extend ActiveModel::Naming if defined?(ActiveModel::Naming)
65
- include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
66
-
67
- def to_label
68
- end
69
-
70
- def persisted?
71
- end
50
+ # Resource-oriented styles like form_for(@post) will expect a path method
51
+ # for the object, so we're defining some here.
52
+ # the argument is required for Rails 4 tests
53
+ def authors_path(*_args)
54
+ '/authors'
72
55
  end
73
56
 
74
- class ::Genre
75
- extend ActiveModel::Naming if defined?(ActiveModel::Naming)
76
- include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
77
-
78
- def to_label
79
- end
57
+ def self.included(base)
58
+ base.class_eval do
59
+ attr_accessor :output_buffer
80
60
 
81
- def persisted?
61
+ def protect_against_forgery?
62
+ false
63
+ end
82
64
  end
83
65
  end
84
66
 
85
- def mock_everything
86
- # Resource-oriented styles like form_for(@post) will expect a path method for the object,
87
- # so we're defining some here.
88
- def author_path(*_args)
89
- '/authors/1'
90
- end
91
-
92
- def authors_path(*_args)
93
- '/authors'
94
- end
67
+ private
95
68
 
96
- def new_author_path(*_args)
97
- '/authors/new'
69
+ def mock_author
70
+ @author = ::Author.new
71
+ { login: 'fred_smith', email: 'fred@foo.com', url: 'http://example.com',
72
+ some_number: '42', phone: '317 456 2564', active: true,
73
+ description: 'bla bla bla', birthdate: DateTime.parse('1969-06-18 20:30'),
74
+ forty_two: DateTime.parse('1969-06-18 20:30') + 42.years,
75
+ time_zone: 'Perth', publish_date: Date.new(2000, 1, 1),
76
+ favorite_color: '#424242', favorite_book: nil }.each do |m, v|
77
+ allow(@author).to receive(m).and_return(v)
98
78
  end
79
+ end
99
80
 
100
- @author = ::Author.new
101
- allow(@author).to receive(:class).and_return(::Author)
102
- allow(@author).to receive(:to_label).and_return('Fred Smith')
103
- allow(@author).to receive(:login).and_return('fred_smith')
104
- allow(@author).to receive(:email).and_return('fred@foo.com')
105
- allow(@author).to receive(:url).and_return('http://example.com')
106
- allow(@author).to receive(:some_number).and_return('42')
107
- allow(@author).to receive(:phone).and_return('317 456 2564')
108
- allow(@author).to receive(:password).and_return('secret')
109
- allow(@author).to receive(:active).and_return(true)
110
- allow(@author).to receive(:description).and_return('bla bla bla')
111
- allow(@author).to receive(:avatar).and_return('avatar.png')
112
- allow(@author).to receive(:birthdate).and_return(DateTime.parse('1969-06-18 20:30'))
113
- allow(@author).to receive(:id).and_return(37)
114
- allow(@author).to receive(:new_record?).and_return(false)
115
- allow(@author).to receive(:errors).and_return(double('errors', :[] => nil))
116
- allow(@author).to receive(:to_key).and_return(nil)
117
- allow(@author).to receive(:persisted?).and_return(nil)
118
- allow(@author).to receive(:time_zone).and_return('Perth')
119
- allow(@author).to receive(:publish_date).and_return(Date.new(2000, 1, 1))
120
- allow(@author).to receive(:forty_two).and_return(@author.birthdate + 42.years)
121
- allow(@author).to receive(:favorite_color).and_return('#424242')
122
- allow(@author).to receive(:favorite_book).and_return(nil)
81
+ def mock_books
82
+ mock_book_0
83
+ mock_book_1
84
+ allow(::Book).to receive(:all).and_return([@book_0, @book_1])
85
+ end
123
86
 
87
+ def mock_book_0
124
88
  @book_0 = ::Book.new
125
89
  allow(@book_0).to receive(:id).and_return('78')
126
90
  allow(@book_0).to receive(:title).and_return("Gulliver's Travels")
91
+ end
92
+
93
+ def mock_book_1
127
94
  @book_1 = ::Book.new
128
95
  allow(@book_1).to receive(:id).and_return('133')
129
96
  allow(@book_1).to receive(:title).and_return('Treasure Island')
97
+ end
98
+
99
+ def mock_genres
100
+ mock_genre_0
101
+ mock_genre_1
102
+ allow(::Genre).to receive(:all).and_return([@genre_0, @genre_1])
103
+ end
104
+
105
+ def mock_genre_0
130
106
  @genre_0 = ::Genre.new
131
107
  allow(@genre_0).to receive(:name).and_return('Exploration')
132
108
  allow(@genre_0).to receive(:books).and_return([@book_0])
109
+ end
110
+
111
+ def mock_genre_1
133
112
  @genre_1 = ::Genre.new
134
113
  allow(@genre_1).to receive(:name).and_return('Pirate Exploits')
135
114
  allow(@genre_1).to receive(:books).and_return([@book_1])
136
-
137
- allow(::Author).to receive(:scoped).and_return(::Author)
138
- allow(::Author).to receive(:find).and_return([@author])
139
- allow(::Author).to receive(:all).and_return([@author])
140
- allow(::Author).to receive(:where).and_return([@author])
141
- allow(::Author).to receive(:human_attribute_name) { |column_name| column_name.to_s.humanize }
142
- allow(::Author).to receive(:human_name).and_return('::Author')
143
- allow(::Author).to receive(:content_columns).and_return([double('column', name: 'login'), double('column', name: 'created_at')])
144
- allow(::Author).to receive(:to_key).and_return(nil)
145
- allow(::Author).to receive(:persisted?).and_return(nil)
146
-
147
- allow(::Book).to receive(:all).and_return([@book_0, @book_1])
148
- allow(::Genre).to receive(:all).and_return([@genre_0, @genre_1])
149
- end
150
-
151
- def self.included(base)
152
- base.class_eval do
153
- attr_accessor :output_buffer
154
-
155
- def protect_against_forgery?
156
- false
157
- end
158
- end
159
115
  end
160
116
  end
metadata CHANGED
@@ -1,71 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foundation_rails_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien Gruhier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: '4.1'
22
+ version: 5.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.0'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: '4.1'
32
+ version: 5.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: actionpack
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '5.0'
31
40
  - - ">="
32
41
  - !ruby/object:Gem::Version
33
- version: '4.1'
42
+ version: 5.0.0
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '5.0'
38
50
  - - ">="
39
51
  - !ruby/object:Gem::Version
40
- version: '4.1'
52
+ version: 5.0.0
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: activemodel
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '5.0'
45
60
  - - ">="
46
61
  - !ruby/object:Gem::Version
47
- version: '4.1'
62
+ version: 5.0.0
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '5.0'
52
70
  - - ">="
53
71
  - !ruby/object:Gem::Version
54
- version: '4.1'
72
+ version: 5.0.0
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: activesupport
57
75
  requirement: !ruby/object:Gem::Requirement
58
76
  requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '5.0'
59
80
  - - ">="
60
81
  - !ruby/object:Gem::Version
61
- version: '4.1'
82
+ version: 5.0.0
62
83
  type: :runtime
63
84
  prerelease: false
64
85
  version_requirements: !ruby/object:Gem::Requirement
65
86
  requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5.0'
66
90
  - - ">="
67
91
  - !ruby/object:Gem::Version
68
- version: '4.1'
92
+ version: 5.0.0
69
93
  - !ruby/object:Gem::Dependency
70
94
  name: tzinfo
71
95
  requirement: !ruby/object:Gem::Requirement
@@ -90,14 +114,14 @@ dependencies:
90
114
  name: rspec-rails
91
115
  requirement: !ruby/object:Gem::Requirement
92
116
  requirements:
93
- - - ">="
117
+ - - "~>"
94
118
  - !ruby/object:Gem::Version
95
119
  version: '3.1'
96
120
  type: :development
97
121
  prerelease: false
98
122
  version_requirements: !ruby/object:Gem::Requirement
99
123
  requirements:
100
- - - ">="
124
+ - - "~>"
101
125
  - !ruby/object:Gem::Version
102
126
  version: '3.1'
103
127
  - !ruby/object:Gem::Dependency
@@ -132,16 +156,16 @@ dependencies:
132
156
  name: rubocop
133
157
  requirement: !ruby/object:Gem::Requirement
134
158
  requirements:
135
- - - ">"
159
+ - - "~>"
136
160
  - !ruby/object:Gem::Version
137
- version: '0.41'
161
+ version: 0.44.1
138
162
  type: :development
139
163
  prerelease: false
140
164
  version_requirements: !ruby/object:Gem::Requirement
141
165
  requirements:
142
- - - ">"
166
+ - - "~>"
143
167
  - !ruby/object:Gem::Version
144
- version: '0.41'
168
+ version: 0.44.1
145
169
  description: Rails for zurb foundation CSS framework. Form builder, flash message,
146
170
  ...
147
171
  email:
@@ -167,6 +191,7 @@ files:
167
191
  - lib/foundation_rails_helper/configuration.rb
168
192
  - lib/foundation_rails_helper/flash_helper.rb
169
193
  - lib/foundation_rails_helper/form_builder.rb
194
+ - lib/foundation_rails_helper/size_class_calculator.rb
170
195
  - lib/foundation_rails_helper/version.rb
171
196
  - lib/railtie.rb
172
197
  - spec/.rubocop.yml
@@ -175,6 +200,9 @@ files:
175
200
  - spec/foundation_rails_helper/form_builder_spec.rb
176
201
  - spec/spec_helper.rb
177
202
  - spec/support/.rubocop.yml
203
+ - spec/support/classes/author.rb
204
+ - spec/support/classes/book.rb
205
+ - spec/support/classes/genre.rb
178
206
  - spec/support/mock_rails.rb
179
207
  homepage: http://github.com/sgruhier/foundation_rails_helper
180
208
  licenses:
@@ -191,12 +219,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
219
  version: '0'
192
220
  required_rubygems_version: !ruby/object:Gem::Requirement
193
221
  requirements:
194
- - - ">="
222
+ - - ">"
195
223
  - !ruby/object:Gem::Version
196
- version: '0'
224
+ version: 1.3.1
197
225
  requirements: []
198
226
  rubyforge_project:
199
- rubygems_version: 2.6.4
227
+ rubygems_version: 2.5.1
200
228
  signing_key:
201
229
  specification_version: 4
202
230
  summary: Rails helpers for zurb foundation CSS framework
@@ -206,5 +234,7 @@ test_files:
206
234
  - spec/foundation_rails_helper/form_builder_spec.rb
207
235
  - spec/spec_helper.rb
208
236
  - spec/support/.rubocop.yml
237
+ - spec/support/classes/author.rb
238
+ - spec/support/classes/book.rb
239
+ - spec/support/classes/genre.rb
209
240
  - spec/support/mock_rails.rb
210
- has_rdoc: