assert 1.1.0 → 2.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.assert.rb +3 -0
- data/README.md +182 -108
- data/Rakefile +0 -3
- data/bin/assert +1 -1
- data/lib/assert.rb +75 -4
- data/lib/assert/assert_runner.rb +76 -0
- data/lib/assert/cli.rb +25 -46
- data/lib/assert/context.rb +3 -3
- data/lib/assert/result.rb +65 -55
- data/lib/assert/runner.rb +19 -38
- data/lib/assert/suite.rb +0 -7
- data/lib/assert/test.rb +4 -16
- data/lib/assert/version.rb +1 -1
- data/lib/assert/view.rb +23 -0
- data/lib/assert/view/base.rb +10 -19
- data/lib/assert/view/default_view.rb +16 -11
- data/lib/assert/view/helpers/ansi_styles.rb +1 -1
- data/lib/assert/view/helpers/common.rb +37 -16
- data/test/assert_test.rb +29 -14
- data/test/context/class_methods_test.rb +2 -2
- data/test/context_test.rb +28 -50
- data/test/helper.rb +4 -2
- data/test/runner_test.rb +5 -4
- data/test/suite_test.rb +1 -1
- data/test/test_test.rb +8 -15
- data/test/view/base_tests.rb +20 -37
- metadata +17 -39
- data/lib/assert/autorun.rb +0 -37
- data/lib/assert/options.rb +0 -43
- data/lib/assert/rake_tasks.rb +0 -75
- data/lib/assert/rake_tasks/irb.rb +0 -33
- data/lib/assert/rake_tasks/scope.rb +0 -100
- data/lib/assert/rake_tasks/test_task.rb +0 -66
- data/lib/assert/result_set.rb +0 -17
- data/lib/assert/setup.rb +0 -3
- data/lib/assert/setup/all.rb +0 -5
- data/lib/assert/setup/helpers.rb +0 -72
- data/lib/assert/setup/options.rb +0 -6
- data/lib/assert/setup/runner.rb +0 -13
- data/lib/assert/setup/suite.rb +0 -13
- data/lib/assert/setup/view.rb +0 -39
- data/lib/assert/view/helpers/capture_output.rb +0 -23
- data/test/default_view_test.rb +0 -16
- data/test/irb.rb +0 -5
- data/test/options_test.rb +0 -40
- data/test/rake_tasks/irb_test.rb +0 -45
- data/test/rake_tasks/scope_test.rb +0 -63
- data/test/rake_tasks/test_task_test.rb +0 -80
- data/test/result_set_test.rb +0 -72
data/.assert.rb
ADDED
data/README.md
CHANGED
@@ -1,7 +1,34 @@
|
|
1
|
-
# The Assert
|
1
|
+
# The Assert Testing Framework
|
2
2
|
|
3
3
|
Test::Unit style testing framework, just better than Test::Unit.
|
4
4
|
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
# in test/my_tests.rb
|
9
|
+
|
10
|
+
require 'assert'
|
11
|
+
|
12
|
+
class MyTests < Assert::Context
|
13
|
+
|
14
|
+
def test_something
|
15
|
+
assert_equal 1, 1
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
```sh
|
22
|
+
$ assert test/my_tests.rb
|
23
|
+
Loaded suite (1 test)
|
24
|
+
Running tests in random order, seeded with "33650"
|
25
|
+
.
|
26
|
+
|
27
|
+
1 result: pass
|
28
|
+
|
29
|
+
(0.000199 seconds)
|
30
|
+
```
|
31
|
+
|
5
32
|
## What Assert is
|
6
33
|
|
7
34
|
* **Framework**: you define tests and the context they run in - Assert runs them. Everything is pure ruby so use any 3rd party testing tools you like. Create 3rd party tools that extend Assert behavior.
|
@@ -17,106 +44,170 @@ Test::Unit style testing framework, just better than Test::Unit.
|
|
17
44
|
|
18
45
|
## Description
|
19
46
|
|
20
|
-
Assert is a Test::Unit style testing framework. This means you can write tests in Assert the same way you would with test-unit.
|
47
|
+
Assert is a Test::Unit style testing framework. This means you can write tests in Assert the same way you would with test-unit.
|
21
48
|
|
22
|
-
Assert
|
49
|
+
In addition, Assert adds some helpers and syntax sugar to enhance the way tests are written. Most are taken from ideas in [Shoulda](https://github.com/thoughtbot/shoulda) and [Leftright](https://github.com/jordi/leftright/). Assert uses class-based contexts so if you want to nest your contexts, use inheritance.
|
23
50
|
|
24
|
-
|
51
|
+
**Note**: Assert is tested using itself. The tests are a pretty good place to look for examples and usage patterns.
|
25
52
|
|
26
|
-
|
27
|
-
|
53
|
+
## CLI
|
54
|
+
|
55
|
+
```sh
|
56
|
+
$ assert --help
|
28
57
|
```
|
29
58
|
|
30
|
-
|
59
|
+
Assert ships with a CLI for running tests. Test files must end in `_tests.rb` (or `_test.rb`). The CLI globs any given file path(s), requires any test files, and runs the tests in them.
|
31
60
|
|
32
|
-
|
33
|
-
require 'assert'
|
61
|
+
As an example, say your test folder has a file structure like so:
|
34
62
|
|
35
|
-
|
63
|
+
```
|
64
|
+
- test
|
65
|
+
| - basic_tests.rb
|
66
|
+
| - helper.rb
|
67
|
+
| - complex_tests.rb
|
68
|
+
| - complex
|
69
|
+
| | - fast_tests.rb
|
70
|
+
| | - slow_tests.rb
|
71
|
+
```
|
36
72
|
|
37
|
-
|
38
|
-
|
39
|
-
|
73
|
+
* `$ assert` - runs all tests ('./test' is used if no paths are given)
|
74
|
+
* `$ assert test/basic` - run all tests in basic_tests.rb
|
75
|
+
* `$ assert test/complex/fast_tests.rb` - runs all tests in fast_tests.rb
|
76
|
+
* `$ assert test/basic test/comp` - runs all tests in basic_tests.rb, complex_tests.rb, fast_tests.rb and slow_tests.rb
|
77
|
+
|
78
|
+
All you need to do is pass some sort of existing file path (hint: use tab-completion) and Assert will find any test files and run the tests in them.
|
79
|
+
|
80
|
+
## Configuring Assert
|
40
81
|
|
82
|
+
```ruby
|
83
|
+
Assert.configure do |config|
|
84
|
+
# set your config options here
|
41
85
|
end
|
42
86
|
```
|
43
87
|
|
44
|
-
|
88
|
+
Assert uses a config pattern for specifying settings. Using this pattern, you can configure settings, extensions, custom views, etc. Settings can be configured in 4 different scopes and are applied in this order: User, Local, CLI, ENV.
|
45
89
|
|
46
|
-
|
90
|
+
### User settings
|
47
91
|
|
48
|
-
|
92
|
+
Assert will look for and require the file `$HOME/.assert/initializer.rb`. Use this file to specify user settings. User settings can be overridden by Local, CLI, and ENV settings.
|
49
93
|
|
50
|
-
|
94
|
+
### Local settings
|
51
95
|
|
52
|
-
|
96
|
+
Assert will look for and require the file `./.assert.rb`. Use this file to specify project settings. Local settings can be overridden by CLI, and ENV settings.
|
53
97
|
|
54
|
-
|
98
|
+
To specify a custom local settings file path, use the `ASSERT_LOCALFILE` env var.
|
55
99
|
|
56
|
-
###
|
100
|
+
### CLI settings
|
57
101
|
|
58
|
-
|
102
|
+
Assert accepts options from its CLI. Use these options to specify runtime settings. CLI settings can be overridden by ENV settings.
|
59
103
|
|
60
|
-
###
|
104
|
+
### ENV settings
|
61
105
|
|
62
|
-
|
106
|
+
Assert uses ENV vars to drive certain settings. Use these vars to specify absolute runtime settings. ENV settings are always applied last and cannot be overridden.
|
63
107
|
|
64
|
-
|
108
|
+
## Running Tests
|
65
109
|
|
66
|
-
|
110
|
+
Assert uses its [`Assert::Runner`](/lib/assert/runner.rb) to run tests. You can extend this default runner or use your own runner implementation. Specify it in your user/local settings:
|
67
111
|
|
68
|
-
|
69
|
-
|
70
|
-
* `Error`
|
71
|
-
* `Skip`
|
72
|
-
* `Ignore`
|
112
|
+
```ruby
|
113
|
+
require 'my_awesome_runner_class'
|
73
114
|
|
74
|
-
|
115
|
+
Assert.configure do |config|
|
116
|
+
config.runner MyAwesomeRunnerClass.new
|
117
|
+
end
|
118
|
+
```
|
75
119
|
|
76
|
-
###
|
120
|
+
### Test Dir
|
77
121
|
|
78
|
-
|
122
|
+
By default Assert expects tests in the `test` dir. The is where it looks for the helper file and is the default path used when running `$ assert`. To override this dir, do so in your user/local settings file:
|
79
123
|
|
80
|
-
|
124
|
+
```ruby
|
125
|
+
Assert.configure do |config|
|
126
|
+
config.test_dir "testing"
|
127
|
+
end
|
128
|
+
```
|
81
129
|
|
82
|
-
|
130
|
+
### Test Helper File
|
83
131
|
|
84
|
-
|
132
|
+
By default Assert will look for a file named `helper.rb` in the `test_dir` and require it (if found) just before running the tests. To override the helper file name, do so in your user/local settings file:
|
85
133
|
|
86
|
-
|
134
|
+
```ruby
|
135
|
+
Assert.configure do |config|
|
136
|
+
config.test_helper "some_helpers.rb"
|
137
|
+
end
|
138
|
+
```
|
87
139
|
|
88
|
-
|
140
|
+
### Test Order
|
89
141
|
|
90
|
-
|
142
|
+
The default runner object runs tests in random order. To run tests in a consistant order, specify a custom runner seed:
|
91
143
|
|
92
|
-
|
144
|
+
In user/local settings file:
|
93
145
|
|
94
146
|
```ruby
|
95
|
-
Assert.
|
147
|
+
Assert.configure do |config|
|
148
|
+
config.runner_seed 1234
|
149
|
+
end
|
96
150
|
```
|
97
151
|
|
98
|
-
|
152
|
+
Using the CLI:
|
153
|
+
|
154
|
+
```sh
|
155
|
+
$ assert [-s|--seed] 1234
|
156
|
+
```
|
99
157
|
|
100
|
-
|
158
|
+
Using an ENV var:
|
101
159
|
|
160
|
+
```sh
|
161
|
+
$ ASSERT_RUNNER_SEED=1234 assert
|
102
162
|
```
|
103
|
-
|
104
|
-
|
163
|
+
|
164
|
+
### Showing Output
|
165
|
+
|
166
|
+
By default, Assert shows any output on `$stdout` produced while running a test. It provides a setting to override whether to show this output or to 'capture' it and show it with the test result details:
|
167
|
+
|
168
|
+
In user/local settings file:
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
Assert.configure do |config|
|
172
|
+
config.show_output false
|
173
|
+
end
|
105
174
|
```
|
106
175
|
|
107
|
-
|
176
|
+
Using the CLI:
|
108
177
|
|
109
|
-
|
178
|
+
```sh
|
179
|
+
$ assert [-o|--show-output|--no-show-output]
|
180
|
+
```
|
181
|
+
|
182
|
+
### Failure Handling
|
183
|
+
|
184
|
+
By default, Assert will halt test execution when a test produces a Fail result. It provides a setting to override this default:
|
110
185
|
|
111
|
-
|
186
|
+
In user/local settings file:
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
Assert.configure do |config|
|
190
|
+
config.halt_on_fail false
|
191
|
+
end
|
192
|
+
```
|
193
|
+
|
194
|
+
Using the CLI:
|
195
|
+
|
196
|
+
```sh
|
197
|
+
$ assert [-t|--halt|--no-halt]
|
198
|
+
```
|
199
|
+
|
200
|
+
## Viewing Test Results
|
201
|
+
|
202
|
+
`Assert::View::DefaultView` is the default handler for viewing test results. Its output goes something like this:
|
112
203
|
|
113
204
|
* before the run starts, output some info about the test suite that is about to run
|
114
205
|
* print out result abbreviations as the test results are generated
|
115
206
|
* after the run finishes...
|
116
|
-
* display any result details (from failing or error results) in reverse test/result order
|
117
|
-
* output some summary info
|
207
|
+
* display any result details (from failing or error results) in reverse test/result order
|
208
|
+
* output some summary info
|
118
209
|
|
119
|
-
You can run
|
210
|
+
You can run a test suite and get a feel for what this default outputs. The view has a few options you can tweak:
|
120
211
|
|
121
212
|
* `styled`: whether to apply ANSI styles to the output, default `true`
|
122
213
|
* `pass_styles`: how to style pass result output, default `:green`
|
@@ -125,20 +216,24 @@ You can run assert's test suite using `rake test` and get a feel for what this d
|
|
125
216
|
* `skip_styles`: default `:cyan`
|
126
217
|
* `ignore_styles`: default: `:magenta`
|
127
218
|
|
128
|
-
To override an option, do so in your user
|
219
|
+
To override an option, do so in your user/local settings:
|
129
220
|
|
130
221
|
```ruby
|
131
|
-
Assert.
|
222
|
+
Assert.configure do |config|
|
223
|
+
config.view.styled false
|
224
|
+
end
|
132
225
|
```
|
133
226
|
|
134
|
-
However, the view you use is configurable. Define you own view class and specify it in your
|
227
|
+
However, the view hanlder you use is itself configurable. Define you own view handler class and specify it in your user/local settings:
|
135
228
|
|
136
229
|
```ruby
|
137
230
|
class MyCustomView < Assert::View::Base
|
138
231
|
# define your view here...
|
139
232
|
end
|
140
233
|
|
141
|
-
Assert.
|
234
|
+
Assert.configure do |config|
|
235
|
+
config.view MyCustomView.new
|
236
|
+
end
|
142
237
|
```
|
143
238
|
|
144
239
|
### Anatomy of a View
|
@@ -157,17 +252,17 @@ Available callbacks from the runner, and when they are called:
|
|
157
252
|
* `after_test`: after a test finishes running, the test is passed as an arg
|
158
253
|
* `on_finish`: when the test suite is finished running
|
159
254
|
|
160
|
-
Beyond that, each view can do as it sees fit. Initialize how you wish, take whatever
|
255
|
+
Beyond that, each view can do as it sees fit. Initialize how you wish, take whatever settings you'd like, and output results as you see fit, given the available callbacks.
|
161
256
|
|
162
257
|
### Using 3rd party views
|
163
258
|
|
164
|
-
To use a 3rd party custom view,
|
259
|
+
To use a 3rd party custom view, first require it in and then configure it. Assert provides a helper for requiring in views. It can be used in two ways. You can pass a fully qualified path to the helper and if it exists, will require it in.
|
165
260
|
|
166
261
|
```ruby
|
167
262
|
Assert::View.require_user_view '/path/to/my/view'
|
168
263
|
```
|
169
264
|
|
170
|
-
Alternatively, you can install/clone/copy/write your view implementations in `~/.assert/views` and require it in by name. To have assert require it by name, have it installed at `~/assert/views/view_name/lib/view_name.rb` (this structure is compatible with popular conventions
|
265
|
+
Alternatively, you can install/clone/copy/write your view implementations in `~/.assert/views` and require it in by name. To have assert require it by name, have it installed at `~/assert/views/view_name/lib/view_name.rb` (this structure is compatible with popular conventions for rubygem development). For example:
|
171
266
|
|
172
267
|
```ruby
|
173
268
|
# assuming ~/.assert/views/my-custom-view/lib/my-custom-view.rb exists
|
@@ -177,75 +272,54 @@ Assert::View.require_user_view 'my-custom-view'
|
|
177
272
|
|
178
273
|
Once your view class is required in, use it and configure it just as you would any view.
|
179
274
|
|
180
|
-
##
|
181
|
-
|
182
|
-
Assert, by default, will halt test execution when a test produces a Fail result. However, Assert provides an option to not halt when Fail results are produced. You can control how assert handles fails by either setting a user option (in your user `~/.assert/options.rb` file):
|
183
|
-
|
184
|
-
```ruby
|
185
|
-
Assert::Test.options.halt_on_fail false # force not halting on fail results
|
186
|
-
```
|
275
|
+
## Assert Models
|
187
276
|
|
188
|
-
|
277
|
+
### Suite
|
189
278
|
|
190
|
-
|
191
|
-
$ rake test halt_on_fail=true # force halt on failure using an env var
|
192
|
-
```
|
279
|
+
A `Suite` object is reponsible for collecting and structuring tests and defines the set of tests to run using the test `Runner`. Tests are grouped within the suite by their context. Suite provides access to the contexts, tests, and test results. In addition, the Suite model provides some stats (ie. run_time, runner_seed, etc...).
|
193
280
|
|
194
|
-
|
281
|
+
### Runner
|
195
282
|
|
196
|
-
|
283
|
+
A `Runner` object is responsible for running a suite of tests and firing event callbacks to the `View`. Any runner object should take the test suite and view as arguments and should provide a 'run' method that runs the tests and renders the view.
|
197
284
|
|
198
|
-
|
285
|
+
### Context
|
199
286
|
|
200
|
-
|
287
|
+
A `Context` object is the scope that tests are run in. When tests are run, a new instance of the test context is created and the test code is evaluated within the scope of this context instance. Context provides methods for defining tests and test callbacks and for generating test results in running tests. Subclass context classes to achieve nested context behavior.
|
201
288
|
|
202
|
-
|
203
|
-
- test
|
204
|
-
| - basic_test.rb
|
205
|
-
| - helper.rb
|
206
|
-
| - complex
|
207
|
-
| | - fast_tests.rb
|
208
|
-
| | - slow_tests.rb
|
209
|
-
```
|
289
|
+
### Test
|
210
290
|
|
211
|
-
|
291
|
+
A `Test` object defines the test code that needs to be run and the results generated by that test code. Tests are aware of their context and are responsible for running their code in context.
|
212
292
|
|
213
|
-
|
214
|
-
require 'assert/rake_tasks'
|
215
|
-
Assert::RakeTasks.install
|
216
|
-
```
|
293
|
+
### Result
|
217
294
|
|
218
|
-
|
295
|
+
A `Result` object defines the data related to a test result. There are a few kinds of test results available:
|
219
296
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
rake test:complex:fast # Run tests for assertions:assert_block
|
226
|
-
rake test:complex:slow # Run tests for assertions:assert_empty
|
227
|
-
```
|
297
|
+
* `Pass`
|
298
|
+
* `Fail`
|
299
|
+
* `Error`
|
300
|
+
* `Skip`
|
301
|
+
* `Ignore`
|
228
302
|
|
229
|
-
|
303
|
+
Tests produce results as they are executed. Every `assert` statement produces a result. Some results, like `Error` and `Skip`, will halt execution. `Pass` and `Ignore` results do not halt execution. `Fail` results, by default, halt execution but there is an option to have them not halt execution. Therefore, tests can have many results of varying types.
|
230
304
|
|
231
|
-
|
232
|
-
$ rake test show_loaded_files=true # run the tests showing which files were loaded
|
233
|
-
```
|
305
|
+
### View
|
234
306
|
|
235
|
-
|
307
|
+
A `View` object is responsible for rendering test result output. Assert provides a `Assert::View::Base` object to provide common helpers and default runner callback handlers for building views. Assert also provides a `Assert::View::DefaultView` that it renders its output with. See the "Viewing Test Results" section below for more details.
|
236
308
|
|
237
|
-
|
309
|
+
### Macro
|
238
310
|
|
239
|
-
|
240
|
-
$ rake irb
|
241
|
-
> Assert
|
242
|
-
=> Assert
|
243
|
-
```
|
311
|
+
Macros are procs that define sets of test code and make it available for easy reuse. Macros work nicely with the 'should' and 'test' context methods.
|
244
312
|
|
245
313
|
## The Assert family of testing tools
|
246
314
|
|
247
315
|
TODO: add in references to assert related tools.
|
248
316
|
|
317
|
+
## Installation
|
318
|
+
|
319
|
+
```
|
320
|
+
$ gem install assert
|
321
|
+
```
|
322
|
+
|
249
323
|
## Contributing
|
250
324
|
|
251
325
|
The source code is hosted on Github. Feel free to submit pull requests and file bugs on the issues tracker.
|
@@ -258,6 +332,6 @@ If submitting a Pull Request, please:
|
|
258
332
|
4. Push to the branch (`git push origin my-new-feature`)
|
259
333
|
5. Create new Pull Request
|
260
334
|
|
261
|
-
One note: please respect that Assert itself is intended to be the flexible, base-level type logic that should change little if at all. Pull requests for niche functionality or personal testing philosphy stuff will likely not be accepted.
|
335
|
+
One note: please respect that Assert itself is intended to be the flexible, base-level, framework-type logic that should change little if at all. Pull requests for niche functionality or personal testing philosphy stuff will likely not be accepted.
|
262
336
|
|
263
|
-
If you wish to extend Assert for your niche purpose/desire/philosophy, please do so in it's own gem (preferrably named
|
337
|
+
If you wish to extend Assert for your niche purpose/desire/philosophy, please do so in it's own gem (preferrably named `assert-<whatever>`) that uses Assert as a dependency. When you do, tell us about it and we'll add to this README with a short description.
|
data/Rakefile
CHANGED
data/bin/assert
CHANGED
data/lib/assert.rb
CHANGED
@@ -1,5 +1,76 @@
|
|
1
|
-
require '
|
2
|
-
require 'assert/autorun'
|
1
|
+
require 'singleton'
|
3
2
|
|
4
|
-
Assert
|
5
|
-
|
3
|
+
module Assert; end
|
4
|
+
|
5
|
+
require 'assert/view'
|
6
|
+
require 'assert/suite'
|
7
|
+
require 'assert/runner'
|
8
|
+
require 'assert/context'
|
9
|
+
|
10
|
+
module Assert
|
11
|
+
|
12
|
+
def self.view; Config.view; end
|
13
|
+
def self.suite; Config.suite; end
|
14
|
+
def self.runner; Config.runner; end
|
15
|
+
|
16
|
+
def self.config; Config; end
|
17
|
+
def self.configure; yield Config if block_given?; end
|
18
|
+
|
19
|
+
def self.init(test_files, opts)
|
20
|
+
# load any test helper file
|
21
|
+
if p = opts[:test_dir_path]
|
22
|
+
helper_file = File.join(p, Config.test_helper)
|
23
|
+
require helper_file if File.exists?(helper_file)
|
24
|
+
end
|
25
|
+
|
26
|
+
# load the test files
|
27
|
+
Assert.view.fire(:before_load, test_files)
|
28
|
+
test_files.each{ |p| require p }
|
29
|
+
Assert.view.fire(:after_load)
|
30
|
+
end
|
31
|
+
|
32
|
+
class Config
|
33
|
+
include Singleton
|
34
|
+
# map any class methods to the singleton
|
35
|
+
def self.method_missing(m, *a, &b); self.instance.send(m, *a, &b); end
|
36
|
+
def self.respond_to?(m); super || self.instance.respond_to?(m); end
|
37
|
+
|
38
|
+
def self.settings(*items)
|
39
|
+
items.each do |item|
|
40
|
+
define_method(item) do |*args|
|
41
|
+
if !(value = args.size > 1 ? args : args.first).nil?
|
42
|
+
instance_variable_set("@#{item}", value)
|
43
|
+
end
|
44
|
+
instance_variable_get("@#{item}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
settings :view, :suite, :runner, :test_dir, :test_helper
|
50
|
+
settings :runner_seed, :show_output, :halt_on_fail, :debug
|
51
|
+
|
52
|
+
def initialize
|
53
|
+
@view = Assert::View::DefaultView.new($stdout)
|
54
|
+
@suite = Assert::Suite.new
|
55
|
+
@runner = Assert::Runner.new
|
56
|
+
@test_dir = "test"
|
57
|
+
@test_helper = "helper.rb"
|
58
|
+
|
59
|
+
# TODO: secure random??
|
60
|
+
@runner_seed = begin; srand; srand % 0xFFFF; end.to_i
|
61
|
+
@show_output = true
|
62
|
+
@halt_on_fail = true
|
63
|
+
@debug = false
|
64
|
+
end
|
65
|
+
|
66
|
+
def apply(settings)
|
67
|
+
settings.keys.each do |name|
|
68
|
+
if !settings[name].nil? && self.respond_to?(name.to_s)
|
69
|
+
self.send(name.to_s, settings[name])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|