optionsful 0.5.1 → 0.5.2
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/VERSION +1 -1
- data/config/optionsful.yml +13 -0
- data/optionsful.gemspec +2 -1
- data/spec/optionsful_configurator_spec.rb +15 -3
- data/spec/optionsful_server_spec.rb +10 -5
- data/spec/spec_helper.rb +10 -0
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/optionsful.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{optionsful}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marco Antonio Gonzalez Junior"]
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
"README.textile",
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
|
+
"config/optionsful.yml",
|
27
28
|
"lib/baurets/optionsful/configurator.rb",
|
28
29
|
"lib/baurets/optionsful/introspections.rb",
|
29
30
|
"lib/baurets/optionsful/server.rb",
|
@@ -8,7 +8,11 @@ describe Baurets::Optionsful::Configurator do
|
|
8
8
|
|
9
9
|
describe "if no directions were explicitly given, act as using the default settings" do
|
10
10
|
|
11
|
-
before do
|
11
|
+
before(:all) do
|
12
|
+
backup_configuration_file
|
13
|
+
end
|
14
|
+
|
15
|
+
before(:each) do
|
12
16
|
delete_configuration_file
|
13
17
|
end
|
14
18
|
|
@@ -16,12 +20,20 @@ describe Baurets::Optionsful::Configurator do
|
|
16
20
|
configuration[:link].should be false
|
17
21
|
end
|
18
22
|
|
23
|
+
after(:all) do
|
24
|
+
restore_configuration_file
|
25
|
+
end
|
26
|
+
|
19
27
|
end
|
20
28
|
|
21
29
|
describe "when there is a custom configuration file, load the settings from it" do
|
30
|
+
|
31
|
+
before(:all) do
|
32
|
+
backup_configuration_file
|
33
|
+
end
|
22
34
|
|
23
35
|
before(:each) do
|
24
|
-
|
36
|
+
delete_configuration_file
|
25
37
|
end
|
26
38
|
|
27
39
|
it "by default, the Link header generation must be disabled" do
|
@@ -57,7 +69,7 @@ describe Baurets::Optionsful::Configurator do
|
|
57
69
|
end
|
58
70
|
|
59
71
|
after(:all) do
|
60
|
-
|
72
|
+
restore_configuration_file
|
61
73
|
end
|
62
74
|
|
63
75
|
end
|
@@ -413,6 +413,10 @@ describe "Optionsful" do
|
|
413
413
|
context "the Link header" do
|
414
414
|
|
415
415
|
describe "should NOT be present" do
|
416
|
+
|
417
|
+
before(:all) do
|
418
|
+
backup_configuration_file
|
419
|
+
end
|
416
420
|
|
417
421
|
before(:each) do
|
418
422
|
rails_app.routes.draw do
|
@@ -431,6 +435,10 @@ describe "Optionsful" do
|
|
431
435
|
after(:each) do
|
432
436
|
Rails.application.reload_routes!
|
433
437
|
end
|
438
|
+
|
439
|
+
after(:all) do
|
440
|
+
restore_configuration_file
|
441
|
+
end
|
434
442
|
|
435
443
|
end
|
436
444
|
|
@@ -440,7 +448,7 @@ describe "Optionsful" do
|
|
440
448
|
rails_app.routes.draw do
|
441
449
|
resources :posts
|
442
450
|
end
|
443
|
-
|
451
|
+
backup_configuration_file
|
444
452
|
end
|
445
453
|
|
446
454
|
before(:each) do
|
@@ -492,12 +500,9 @@ describe "Optionsful" do
|
|
492
500
|
link.should match /\A\"<http:\/\/www.baurets.net\/api\/posts.+\"\z/
|
493
501
|
end
|
494
502
|
|
495
|
-
after(:each) do
|
496
|
-
delete_configuration_file
|
497
|
-
end
|
498
|
-
|
499
503
|
after(:all) do
|
500
504
|
Rails.application.reload_routes!
|
505
|
+
restore_configuration_file
|
501
506
|
end
|
502
507
|
|
503
508
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -92,6 +92,16 @@ DEFAULT_ENV = { "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "
|
|
92
92
|
FileUtils.rm [File.join(Rails.root, 'config', 'optionsful.yml')] if File.exist? File.join(Rails.root, 'config', 'optionsful.yml')
|
93
93
|
end
|
94
94
|
|
95
|
+
def backup_configuration_file
|
96
|
+
FileUtils.cp File.join(Rails.root, 'config', 'optionsful.yml'), File.join(Rails.root, 'config', 'optionsful.yml.tmp') if File.exist? File.join(Rails.root, 'config', 'optionsful.yml')
|
97
|
+
FileUtils.rm [File.join(Rails.root, 'config', 'optionsful.yml')]
|
98
|
+
end
|
99
|
+
|
100
|
+
def restore_configuration_file
|
101
|
+
FileUtils.cp File.join(Rails.root, 'config', 'optionsful.yml.tmp'), File.join(Rails.root, 'config', 'optionsful.yml') if File.exist? File.join(Rails.root, 'config', 'optionsful.yml.tmp')
|
102
|
+
FileUtils.rm [File.join(Rails.root, 'config', 'optionsful.yml.tmp')] if File.exist? File.join(Rails.root, 'config', 'optionsful.yml.tmp')
|
103
|
+
end
|
104
|
+
|
95
105
|
def copy_configuration_file(name)
|
96
106
|
FileUtils.cp File.join(Rails.root, 'samples', name), File.join(Rails.root, 'config', 'optionsful.yml')
|
97
107
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optionsful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marco Antonio Gonzalez Junior
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- README.textile
|
82
82
|
- Rakefile
|
83
83
|
- VERSION
|
84
|
+
- config/optionsful.yml
|
84
85
|
- lib/baurets/optionsful/configurator.rb
|
85
86
|
- lib/baurets/optionsful/introspections.rb
|
86
87
|
- lib/baurets/optionsful/server.rb
|