foundation_rails_helper 0.5.0 → 1.0.0
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -0
- data/CHANGELOG.md +7 -0
- data/CONTRIBUTING.md +40 -0
- data/LICENSE +2 -2
- data/README.md +44 -58
- data/foundation_rails_helper.gemspec +1 -1
- data/lib/foundation_rails_helper.rb +2 -1
- data/lib/foundation_rails_helper/action_view_extension.rb +0 -2
- data/lib/foundation_rails_helper/configuration.rb +25 -0
- data/lib/foundation_rails_helper/flash_helper.rb +4 -3
- data/lib/foundation_rails_helper/form_builder.rb +10 -8
- data/lib/foundation_rails_helper/version.rb +1 -1
- data/spec/foundation_rails_helper/configuration_spec.rb +37 -0
- data/spec/foundation_rails_helper/flash_helper_spec.rb +10 -10
- data/spec/foundation_rails_helper/form_builder_spec.rb +304 -147
- data/spec/support/mock_rails.rb +44 -44
- metadata +10 -6
data/spec/support/mock_rails.rb
CHANGED
@@ -29,7 +29,7 @@ module FoundationRailsSpecHelper
|
|
29
29
|
|
30
30
|
def active_model_validator(kind, attributes, options = {})
|
31
31
|
validator = mock("ActiveModel::Validations::#{kind.to_s.titlecase}Validator", :attributes => attributes, :options => options)
|
32
|
-
validator.
|
32
|
+
allow(validator).to receive(:kind).and_return(kind)
|
33
33
|
validator
|
34
34
|
end
|
35
35
|
|
@@ -90,54 +90,54 @@ module FoundationRailsSpecHelper
|
|
90
90
|
def new_author_path(*args); "/authors/new"; end
|
91
91
|
|
92
92
|
@author = ::Author.new
|
93
|
-
@author.
|
94
|
-
@author.
|
95
|
-
@author.
|
96
|
-
@author.
|
97
|
-
@author.
|
98
|
-
@author.
|
99
|
-
@author.
|
100
|
-
@author.
|
101
|
-
@author.
|
102
|
-
@author.
|
103
|
-
@author.
|
104
|
-
@author.
|
105
|
-
@author.
|
106
|
-
@author.
|
107
|
-
@author.
|
108
|
-
@author.
|
109
|
-
@author.
|
110
|
-
@author.
|
111
|
-
@author.
|
112
|
-
@author.
|
113
|
-
@author.
|
114
|
-
@author.
|
93
|
+
allow(@author).to receive(:class).and_return(::Author)
|
94
|
+
allow(@author).to receive(:to_label).and_return('Fred Smith')
|
95
|
+
allow(@author).to receive(:login).and_return('fred_smith')
|
96
|
+
allow(@author).to receive(:email).and_return('fred@foo.com')
|
97
|
+
allow(@author).to receive(:url).and_return('http://example.com')
|
98
|
+
allow(@author).to receive(:some_number).and_return('42')
|
99
|
+
allow(@author).to receive(:phone).and_return('317 456 2564')
|
100
|
+
allow(@author).to receive(:password).and_return('secret')
|
101
|
+
allow(@author).to receive(:active).and_return(true)
|
102
|
+
allow(@author).to receive(:description).and_return('bla bla bla')
|
103
|
+
allow(@author).to receive(:avatar).and_return('avatar.png')
|
104
|
+
allow(@author).to receive(:birthdate).and_return(DateTime.parse("1969-06-18 20:30"))
|
105
|
+
allow(@author).to receive(:id).and_return(37)
|
106
|
+
allow(@author).to receive(:new_record?).and_return(false)
|
107
|
+
allow(@author).to receive(:errors).and_return(double('errors', :[] => nil))
|
108
|
+
allow(@author).to receive(:to_key).and_return(nil)
|
109
|
+
allow(@author).to receive(:persisted?).and_return(nil)
|
110
|
+
allow(@author).to receive(:time_zone).and_return("Perth")
|
111
|
+
allow(@author).to receive(:publish_date).and_return(Date.new( 2000, 1, 1 ))
|
112
|
+
allow(@author).to receive(:forty_two).and_return(@author.birthdate + 42.years)
|
113
|
+
allow(@author).to receive(:favorite_color).and_return("#424242")
|
114
|
+
allow(@author).to receive(:favorite_book).and_return(nil)
|
115
115
|
|
116
116
|
@book_0 = ::Book.new
|
117
|
-
@book_0.
|
118
|
-
@book_0.
|
117
|
+
allow(@book_0).to receive(:id).and_return("78")
|
118
|
+
allow(@book_0).to receive(:title).and_return("Gulliver's Travels")
|
119
119
|
@book_1 = ::Book.new
|
120
|
-
@book_1.
|
121
|
-
@book_1.
|
120
|
+
allow(@book_1).to receive(:id).and_return("133")
|
121
|
+
allow(@book_1).to receive(:title).and_return("Treasure Island")
|
122
122
|
@genre_0 = ::Genre.new
|
123
|
-
@genre_0.
|
124
|
-
@genre_0.
|
123
|
+
allow(@genre_0).to receive(:name).and_return("Exploration")
|
124
|
+
allow(@genre_0).to receive(:books).and_return([@book_0])
|
125
125
|
@genre_1 = ::Genre.new
|
126
|
-
@genre_1.
|
127
|
-
@genre_1.
|
128
|
-
|
129
|
-
::Author.
|
130
|
-
::Author.
|
131
|
-
::Author.
|
132
|
-
::Author.
|
133
|
-
::Author.
|
134
|
-
::Author.
|
135
|
-
::Author.
|
136
|
-
::Author.
|
137
|
-
::Author.
|
138
|
-
|
139
|
-
::Book.
|
140
|
-
::Genre.
|
126
|
+
allow(@genre_1).to receive(:name).and_return("Pirate Exploits")
|
127
|
+
allow(@genre_1).to receive(:books).and_return([@book_1])
|
128
|
+
|
129
|
+
allow(::Author).to receive(:scoped).and_return(::Author)
|
130
|
+
allow(::Author).to receive(:find).and_return([@author])
|
131
|
+
allow(::Author).to receive(:all).and_return([@author])
|
132
|
+
allow(::Author).to receive(:where).and_return([@author])
|
133
|
+
allow(::Author).to receive(:human_attribute_name) { |column_name| column_name.to_s.humanize }
|
134
|
+
allow(::Author).to receive(:human_name).and_return('::Author')
|
135
|
+
allow(::Author).to receive(:content_columns).and_return([double('column', :name => 'login'), double('column', :name => 'created_at')])
|
136
|
+
allow(::Author).to receive(:to_key).and_return(nil)
|
137
|
+
allow(::Author).to receive(:persisted?).and_return(nil)
|
138
|
+
|
139
|
+
allow(::Book).to receive(:all).and_return([@book_0, @book_1])
|
140
|
+
allow(::Genre).to receive(:all).and_return([@genre_0, @genre_1])
|
141
141
|
end
|
142
142
|
|
143
143
|
def self.included(base)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foundation_rails_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Gruhier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -116,20 +116,20 @@ dependencies:
|
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '
|
119
|
+
version: '3.1'
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: 3.1.0
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '
|
129
|
+
version: '3.1'
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: 3.1.0
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: capybara
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- ".rspec"
|
163
163
|
- ".travis.yml"
|
164
164
|
- CHANGELOG.md
|
165
|
+
- CONTRIBUTING.md
|
165
166
|
- Gemfile
|
166
167
|
- LICENSE
|
167
168
|
- README.md
|
@@ -169,10 +170,12 @@ files:
|
|
169
170
|
- foundation_rails_helper.gemspec
|
170
171
|
- lib/foundation_rails_helper.rb
|
171
172
|
- lib/foundation_rails_helper/action_view_extension.rb
|
173
|
+
- lib/foundation_rails_helper/configuration.rb
|
172
174
|
- lib/foundation_rails_helper/flash_helper.rb
|
173
175
|
- lib/foundation_rails_helper/form_builder.rb
|
174
176
|
- lib/foundation_rails_helper/version.rb
|
175
177
|
- lib/railtie.rb
|
178
|
+
- spec/foundation_rails_helper/configuration_spec.rb
|
176
179
|
- spec/foundation_rails_helper/flash_helper_spec.rb
|
177
180
|
- spec/foundation_rails_helper/form_builder_spec.rb
|
178
181
|
- spec/spec_helper.rb
|
@@ -202,6 +205,7 @@ signing_key:
|
|
202
205
|
specification_version: 4
|
203
206
|
summary: Rails helpers for zurb foundation CSS framework
|
204
207
|
test_files:
|
208
|
+
- spec/foundation_rails_helper/configuration_spec.rb
|
205
209
|
- spec/foundation_rails_helper/flash_helper_spec.rb
|
206
210
|
- spec/foundation_rails_helper/form_builder_spec.rb
|
207
211
|
- spec/spec_helper.rb
|