Permalink
Browse files

Specs for POST to update gate json responses.

  • Loading branch information...
1 parent 279b141 commit 2604a16de1810aa87d8d08bffabbc9901fdbe976 @jnunemaker committed Feb 18, 2013
Showing with 56 additions and 0 deletions.
  1. +56 −0 spec/flipper-ui/middleware_spec.rb
@@ -121,6 +121,14 @@ def app
last_response.status.should be(200)
end
+ it "responds with json" do
+ result = json_response
+ result.should be_instance_of(Hash)
+ result['name'].should eq('boolean')
+ result['key'].should eq('boolean')
+ result['value'].should eq(false)
+ end
+
it "updates gate state" do
flipper[:some_thing].state.should be(:off)
end
@@ -140,6 +148,14 @@ def app
last_response.status.should be(200)
end
+ it "responds with json" do
+ result = json_response
+ result.should be_instance_of(Hash)
+ result['name'].should eq('percentage_of_actors')
+ result['key'].should eq('percentage_of_actors')
+ result['value'].should eq(5)
+ end
+
it "updates gate state" do
gate_value(:some_thing, :percentage_of_actors).to_i.should be(5)
end
@@ -180,6 +196,14 @@ def app
last_response.status.should be(200)
end
+ it "responds with json" do
+ result = json_response
+ result.should be_instance_of(Hash)
+ result['name'].should eq('percentage_of_random')
+ result['key'].should eq('percentage_of_random')
+ result['value'].should eq(5)
+ end
+
it "updates gate state" do
gate_value(:some_thing, :percentage_of_random).to_i.should be(5)
end
@@ -221,6 +245,14 @@ def app
last_response.status.should be(200)
end
+ it "responds with json" do
+ result = json_response
+ result.should be_instance_of(Hash)
+ result['name'].should eq('actor')
+ result['key'].should eq('actors')
+ result['value'].should eq(['11'])
+ end
+
it "updates gate state" do
gate_value(:some_thing, :actors).should include('11')
end
@@ -241,6 +273,14 @@ def app
last_response.status.should be(200)
end
+ it "responds with json" do
+ result = json_response
+ result.should be_instance_of(Hash)
+ result['name'].should eq('actor')
+ result['key'].should eq('actors')
+ result['value'].should eq([])
+ end
+
it "updates gate state" do
gate_value(:some_thing, :actors).should_not include('11')
end
@@ -291,6 +331,14 @@ def app
last_response.status.should be(200)
end
+ it "responds with json" do
+ result = json_response
+ result.should be_instance_of(Hash)
+ result['name'].should eq('group')
+ result['key'].should eq('groups')
+ result['value'].should eq(['admins'])
+ end
+
it "updates gate state" do
gate_value(:some_thing, :groups).should include('admins')
end
@@ -311,6 +359,14 @@ def app
last_response.status.should be(200)
end
+ it "responds with json" do
+ result = json_response
+ result.should be_instance_of(Hash)
+ result['name'].should eq('group')
+ result['key'].should eq('groups')
+ result['value'].should eq([])
+ end
+
it "updates gate state" do
gate_value(:some_thing, :groups).should_not include('admins')
end

0 comments on commit 2604a16

Please sign in to comment.