flipper-ui 0.9.1 → 0.9.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.
- checksums.yaml +4 -4
- data/flipper-ui.gemspec +1 -1
- data/lib/flipper/ui.rb +2 -0
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/ui/actions/actors_gate_spec.rb +21 -6
- data/spec/flipper/ui/actions/boolean_gate_spec.rb +19 -4
- data/spec/flipper/ui/actions/feature_spec.rb +19 -4
- data/spec/flipper/ui/actions/features_spec.rb +19 -4
- data/spec/flipper/ui/actions/gate_spec.rb +17 -2
- data/spec/flipper/ui/actions/groups_gate_spec.rb +21 -6
- data/spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb +19 -4
- data/spec/flipper/ui/actions/percentage_of_time_gate_spec.rb +19 -4
- data/spec/flipper/ui_spec.rb +17 -2
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45f1990bf36f30c757d4ac3624c3807cfaf38fc5
|
4
|
+
data.tar.gz: dbc9ad3ae6148944440c71fcbeab8f6a9fc16564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb661b83d7071b9f038554a6e48a7f595c241aef211eaf1cbca14bf9127f8102c5a4efe3e04f9b201e3c819ff26c98b56e4d8f016b2215d9f85e09730eedcba3
|
7
|
+
data.tar.gz: 9793109586cf8620ad6756ed56c63b9857a6444607c20bc3e52da28240ed98de7864d04421d7f01c93a69c112a5fd6c135f0982149078e5482908e2e303bc8c2
|
data/flipper-ui.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.version = Flipper::VERSION
|
21
21
|
|
22
22
|
gem.add_dependency 'rack', '>= 1.4', '< 3'
|
23
|
-
gem.add_dependency 'rack-protection', '
|
23
|
+
gem.add_dependency 'rack-protection', '>= 1.5.3', '< 2.1.0'
|
24
24
|
gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
|
25
25
|
gem.add_dependency 'erubis', '~> 2.7.0'
|
26
26
|
end
|
data/lib/flipper/ui.rb
CHANGED
data/lib/flipper/version.rb
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::ActorsGate do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "GET /features/:feature/actors" do
|
5
20
|
before do
|
6
21
|
get "features/search/actors"
|
@@ -19,8 +34,8 @@ RSpec.describe Flipper::UI::Actions::ActorsGate do
|
|
19
34
|
context "enabling an actor" do
|
20
35
|
before do
|
21
36
|
post "features/search/actors",
|
22
|
-
{"value" => "User:6", "operation" => "enable", "authenticity_token" =>
|
23
|
-
"rack.session" =>
|
37
|
+
{"value" => "User:6", "operation" => "enable", "authenticity_token" => token},
|
38
|
+
"rack.session" => session
|
24
39
|
end
|
25
40
|
|
26
41
|
it "adds item to members" do
|
@@ -37,8 +52,8 @@ RSpec.describe Flipper::UI::Actions::ActorsGate do
|
|
37
52
|
before do
|
38
53
|
flipper[:search].enable_actor Flipper::UI::Actor.new("User:6")
|
39
54
|
post "features/search/actors",
|
40
|
-
{"value" => "User:6", "operation" => "disable", "authenticity_token" =>
|
41
|
-
"rack.session" =>
|
55
|
+
{"value" => "User:6", "operation" => "disable", "authenticity_token" => token},
|
56
|
+
"rack.session" => session
|
42
57
|
end
|
43
58
|
|
44
59
|
it "removes item from members" do
|
@@ -54,8 +69,8 @@ RSpec.describe Flipper::UI::Actions::ActorsGate do
|
|
54
69
|
context "for an invalid actor value" do
|
55
70
|
before do
|
56
71
|
post "features/search/actors",
|
57
|
-
{"value" => "", "operation" => "enable", "authenticity_token" =>
|
58
|
-
"rack.session" =>
|
72
|
+
{"value" => "", "operation" => "enable", "authenticity_token" => token},
|
73
|
+
"rack.session" => session
|
59
74
|
end
|
60
75
|
|
61
76
|
it "redirects back to feature" do
|
@@ -1,13 +1,28 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::BooleanGate do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "POST /features/:feature/boolean" do
|
5
20
|
context "with enable" do
|
6
21
|
before do
|
7
22
|
flipper.disable :search
|
8
23
|
post "features/search/boolean",
|
9
|
-
{"action" => "Enable", "authenticity_token" =>
|
10
|
-
"rack.session" =>
|
24
|
+
{"action" => "Enable", "authenticity_token" => token},
|
25
|
+
"rack.session" => session
|
11
26
|
end
|
12
27
|
|
13
28
|
it "enables the feature" do
|
@@ -24,8 +39,8 @@ RSpec.describe Flipper::UI::Actions::BooleanGate do
|
|
24
39
|
before do
|
25
40
|
flipper.enable :search
|
26
41
|
post "features/search/boolean",
|
27
|
-
{"action" => "Disable", "authenticity_token" =>
|
28
|
-
"rack.session" =>
|
42
|
+
{"action" => "Disable", "authenticity_token" => token},
|
43
|
+
"rack.session" => session
|
29
44
|
end
|
30
45
|
|
31
46
|
it "disables the feature" do
|
@@ -1,12 +1,27 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::Feature do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "DELETE /features/:feature" do
|
5
20
|
before do
|
6
21
|
flipper.enable :search
|
7
22
|
delete "/features/search",
|
8
|
-
{"authenticity_token" =>
|
9
|
-
"rack.session" =>
|
23
|
+
{"authenticity_token" => token},
|
24
|
+
"rack.session" => session
|
10
25
|
end
|
11
26
|
|
12
27
|
it "removes feature" do
|
@@ -23,8 +38,8 @@ RSpec.describe Flipper::UI::Actions::Feature do
|
|
23
38
|
before do
|
24
39
|
flipper.enable :search
|
25
40
|
post "/features/search",
|
26
|
-
{"_method" => "DELETE", "authenticity_token" =>
|
27
|
-
"rack.session" =>
|
41
|
+
{"_method" => "DELETE", "authenticity_token" => token},
|
42
|
+
"rack.session" => session
|
28
43
|
end
|
29
44
|
|
30
45
|
it "removes feature" do
|
@@ -1,6 +1,21 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::Features do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "GET /features" do
|
5
20
|
before do
|
6
21
|
flipper[:stats].enable
|
@@ -23,8 +38,8 @@ RSpec.describe Flipper::UI::Actions::Features do
|
|
23
38
|
@original_feature_creation_enabled = Flipper::UI.feature_creation_enabled
|
24
39
|
Flipper::UI.feature_creation_enabled = true
|
25
40
|
post "/features",
|
26
|
-
{"value" => "notifications_next", "authenticity_token" =>
|
27
|
-
"rack.session" =>
|
41
|
+
{"value" => "notifications_next", "authenticity_token" => token},
|
42
|
+
"rack.session" => session
|
28
43
|
end
|
29
44
|
|
30
45
|
after do
|
@@ -46,8 +61,8 @@ RSpec.describe Flipper::UI::Actions::Features do
|
|
46
61
|
@original_feature_creation_enabled = Flipper::UI.feature_creation_enabled
|
47
62
|
Flipper::UI.feature_creation_enabled = false
|
48
63
|
post "/features",
|
49
|
-
{"value" => "notifications_next", "authenticity_token" =>
|
50
|
-
"rack.session" =>
|
64
|
+
{"value" => "notifications_next", "authenticity_token" => token},
|
65
|
+
"rack.session" => session
|
51
66
|
end
|
52
67
|
|
53
68
|
after do
|
@@ -1,11 +1,26 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::Gate do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "POST /features/:feature/non-existent-gate" do
|
5
20
|
before do
|
6
21
|
post "/features/search/non-existent-gate",
|
7
|
-
{"authenticity_token" =>
|
8
|
-
"rack.session" =>
|
22
|
+
{"authenticity_token" => token},
|
23
|
+
"rack.session" => session
|
9
24
|
end
|
10
25
|
|
11
26
|
it "responds with redirect" do
|
@@ -1,6 +1,21 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::GroupsGate do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "GET /features/:feature/groups" do
|
5
20
|
before do
|
6
21
|
Flipper.register(:admins) { |user| user.admin? }
|
@@ -32,8 +47,8 @@ RSpec.describe Flipper::UI::Actions::GroupsGate do
|
|
32
47
|
context "enabling a group" do
|
33
48
|
before do
|
34
49
|
post "features/search/groups",
|
35
|
-
{"value" => "admins", "operation" => "enable", "authenticity_token" =>
|
36
|
-
"rack.session" =>
|
50
|
+
{"value" => "admins", "operation" => "enable", "authenticity_token" => token},
|
51
|
+
"rack.session" => session
|
37
52
|
end
|
38
53
|
|
39
54
|
it "adds item to members" do
|
@@ -50,8 +65,8 @@ RSpec.describe Flipper::UI::Actions::GroupsGate do
|
|
50
65
|
before do
|
51
66
|
flipper[:search].enable_group :admins
|
52
67
|
post "features/search/groups",
|
53
|
-
{"value" => "admins", "operation" => "disable", "authenticity_token" =>
|
54
|
-
"rack.session" =>
|
68
|
+
{"value" => "admins", "operation" => "disable", "authenticity_token" => token},
|
69
|
+
"rack.session" => session
|
55
70
|
end
|
56
71
|
|
57
72
|
it "removes item from members" do
|
@@ -67,8 +82,8 @@ RSpec.describe Flipper::UI::Actions::GroupsGate do
|
|
67
82
|
context "for an unregistered group" do
|
68
83
|
before do
|
69
84
|
post "features/search/groups",
|
70
|
-
{"value" => "not_here", "operation" => "enable", "authenticity_token" =>
|
71
|
-
"rack.session" =>
|
85
|
+
{"value" => "not_here", "operation" => "enable", "authenticity_token" => token},
|
86
|
+
"rack.session" => session
|
72
87
|
end
|
73
88
|
|
74
89
|
it "redirects back to feature" do
|
@@ -1,12 +1,27 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::PercentageOfActorsGate do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "POST /features/:feature/percentage_of_actors" do
|
5
20
|
context "with valid value" do
|
6
21
|
before do
|
7
22
|
post "features/search/percentage_of_actors",
|
8
|
-
{"value" => "24", "authenticity_token" =>
|
9
|
-
"rack.session" =>
|
23
|
+
{"value" => "24", "authenticity_token" => token},
|
24
|
+
"rack.session" => session
|
10
25
|
end
|
11
26
|
|
12
27
|
it "enables the feature" do
|
@@ -22,8 +37,8 @@ RSpec.describe Flipper::UI::Actions::PercentageOfActorsGate do
|
|
22
37
|
context "with invalid value" do
|
23
38
|
before do
|
24
39
|
post "features/search/percentage_of_actors",
|
25
|
-
{"value" => "555", "authenticity_token" =>
|
26
|
-
"rack.session" =>
|
40
|
+
{"value" => "555", "authenticity_token" => token},
|
41
|
+
"rack.session" => session
|
27
42
|
end
|
28
43
|
|
29
44
|
it "does not change value" do
|
@@ -1,12 +1,27 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI::Actions::PercentageOfTimeGate do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "POST /features/:feature/percentage_of_time" do
|
5
20
|
context "with valid value" do
|
6
21
|
before do
|
7
22
|
post "features/search/percentage_of_time",
|
8
|
-
{"value" => "24", "authenticity_token" =>
|
9
|
-
"rack.session" =>
|
23
|
+
{"value" => "24", "authenticity_token" => token},
|
24
|
+
"rack.session" => session
|
10
25
|
end
|
11
26
|
|
12
27
|
it "enables the feature" do
|
@@ -22,8 +37,8 @@ RSpec.describe Flipper::UI::Actions::PercentageOfTimeGate do
|
|
22
37
|
context "with invalid value" do
|
23
38
|
before do
|
24
39
|
post "features/search/percentage_of_time",
|
25
|
-
{"value" => "555", "authenticity_token" =>
|
26
|
-
"rack.session" =>
|
40
|
+
{"value" => "555", "authenticity_token" => token},
|
41
|
+
"rack.session" => session
|
27
42
|
end
|
28
43
|
|
29
44
|
it "does not change value" do
|
data/spec/flipper/ui_spec.rb
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
RSpec.describe Flipper::UI do
|
4
|
+
let(:token) {
|
5
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
6
|
+
Rack::Protection::AuthenticityToken.random_token
|
7
|
+
else
|
8
|
+
"a"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
let(:session) {
|
12
|
+
if Rack::Protection::AuthenticityToken.respond_to?(:random_token)
|
13
|
+
{:csrf => token}
|
14
|
+
else
|
15
|
+
{"_csrf_token" => token}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
4
19
|
describe "Initializing middleware with flipper instance" do
|
5
20
|
let(:app) { build_app(flipper) }
|
6
21
|
|
@@ -36,8 +51,8 @@ RSpec.describe Flipper::UI do
|
|
36
51
|
# See https://github.com/jnunemaker/flipper/issues/80
|
37
52
|
it "can route features with names that match static directories" do
|
38
53
|
post "features/refactor-images/actors",
|
39
|
-
{"value" => "User:6", "operation" => "enable", "authenticity_token" =>
|
40
|
-
"rack.session" =>
|
54
|
+
{"value" => "User:6", "operation" => "enable", "authenticity_token" => token},
|
55
|
+
"rack.session" => session
|
41
56
|
expect(last_response.status).to be(302)
|
42
57
|
expect(last_response.headers["Location"]).to eq("/features/refactor-images")
|
43
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -34,30 +34,36 @@ dependencies:
|
|
34
34
|
name: rack-protection
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 1.5.3
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.1.0
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
|
-
- - "
|
47
|
+
- - ">="
|
45
48
|
- !ruby/object:Gem::Version
|
46
49
|
version: 1.5.3
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.1.0
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: flipper
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
50
56
|
requirements:
|
51
57
|
- - "~>"
|
52
58
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.9.
|
59
|
+
version: 0.9.2
|
54
60
|
type: :runtime
|
55
61
|
prerelease: false
|
56
62
|
version_requirements: !ruby/object:Gem::Requirement
|
57
63
|
requirements:
|
58
64
|
- - "~>"
|
59
65
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.9.
|
66
|
+
version: 0.9.2
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: erubis
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|