rest-assured 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rest-assured/models/double.rb +2 -2
- data/lib/rest-assured/version.rb +1 -1
- data/spec/models/double_spec.rb +8 -2
- metadata +14 -17
@@ -26,8 +26,8 @@ module RestAssured
|
|
26
26
|
def toggle_active
|
27
27
|
ne = id ? '!=' : 'IS NOT'
|
28
28
|
|
29
|
-
if active && Double.where("fullpath = ? AND active = ? AND id #{ne} ?", fullpath, true, id).exists?
|
30
|
-
Double.where("fullpath = ? AND id #{ne} ?", fullpath, id).update_all :active => false
|
29
|
+
if active && Double.where("fullpath = ? AND verb = ? AND active = ? AND id #{ne} ?", fullpath, verb, true, id).exists?
|
30
|
+
Double.where("fullpath = ? AND verb = ? AND id #{ne} ?", fullpath, verb, id).update_all :active => false
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/lib/rest-assured/version.rb
CHANGED
data/spec/models/double_spec.rb
CHANGED
@@ -44,34 +44,39 @@ module RestAssured::Models
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe 'when created' do
|
47
|
-
it "toggles active double for the same fullpath" do
|
47
|
+
it "toggles active double for the same fullpath and verb" do
|
48
48
|
f1 = Double.create valid_params
|
49
49
|
f2 = Double.create valid_params
|
50
50
|
f3 = Double.create valid_params.merge(:fullpath => '/some/other/api')
|
51
|
+
f4 = Double.create valid_params.merge(:verb => 'POST')
|
51
52
|
|
52
53
|
f1.reload.active.should be false
|
53
54
|
f2.reload.active.should be true
|
54
55
|
f3.reload.active.should be true
|
56
|
+
f4.reload.active.should be true
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
58
60
|
describe 'when saved' do
|
59
|
-
it "toggles active double for the same fullpath" do
|
61
|
+
it "toggles active double for the same fullpath and verb" do
|
60
62
|
f1 = Double.create valid_params
|
61
63
|
f2 = Double.create valid_params
|
62
64
|
f3 = Double.create valid_params.merge(:fullpath => '/some/other/api')
|
65
|
+
f4 = Double.create valid_params.merge(:verb => 'POST')
|
63
66
|
|
64
67
|
f1.active = true
|
65
68
|
f1.save
|
66
69
|
|
67
70
|
f2.reload.active.should be false
|
68
71
|
f3.reload.active.should be true
|
72
|
+
f4.reload.active.should be true
|
69
73
|
end
|
70
74
|
|
71
75
|
it "makes other doubles inactive only when active bit set to true" do
|
72
76
|
f1 = Double.create valid_params
|
73
77
|
f2 = Double.create valid_params
|
74
78
|
f3 = Double.create valid_params.merge(:fullpath => '/some/other/api')
|
79
|
+
f4 = Double.create valid_params.merge(:verb => 'POST')
|
75
80
|
|
76
81
|
f1.reload.save
|
77
82
|
f2.reload.save
|
@@ -79,6 +84,7 @@ module RestAssured::Models
|
|
79
84
|
f1.reload.active.should be false
|
80
85
|
f2.reload.active.should be true
|
81
86
|
f3.reload.active.should be true
|
87
|
+
f4.reload.active.should be true
|
82
88
|
end
|
83
89
|
end
|
84
90
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-assured
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156381020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.3.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156381020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack-flash
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156380560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.1.2
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156380560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156380100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - <=
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.3.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156380100
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: haml
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156379640 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 3.1.3
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156379640
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: activerecord
|
60
|
-
requirement: &
|
60
|
+
requirement: &2156379180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 3.1.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2156379180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activeresource
|
71
|
-
requirement: &
|
71
|
+
requirement: &2156356520 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 3.1.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2156356520
|
80
80
|
description:
|
81
81
|
email:
|
82
82
|
- artem.avetisyan@bbc.co.uk
|
@@ -194,9 +194,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
- - ! '>='
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
|
-
segments:
|
198
|
-
- 0
|
199
|
-
hash: -90823280967256405
|
200
197
|
requirements: []
|
201
198
|
rubyforge_project: rest-assured
|
202
199
|
rubygems_version: 1.8.10
|