Sha256: 93779d86f57245432a8d5c76a65c7c5bb8f0d5ee505b58191f2e7df10e0da64b
Contents?: true
Size: 1.22 KB
Versions: 8
Compression:
Stored size: 1.22 KB
Contents
require 'helper' describe Flipper::UI::Actions::PercentageOfTimeGate do describe "POST /features/:feature/percentage_of_time" do context "with valid value" do before do post "features/search/percentage_of_time", {"value" => "24", "authenticity_token" => "a"}, "rack.session" => {:csrf => "a"} end it "enables the feature" do flipper[:search].percentage_of_time_value.should be(24) end it "redirects back to feature" do last_response.status.should be(302) last_response.headers["Location"].should eq("/features/search") end end context "with invalid value" do before do post "features/search/percentage_of_time", {"value" => "555", "authenticity_token" => "a"}, "rack.session" => {:csrf => "a"} end it "does not change value" do flipper[:search].percentage_of_time_value.should be(0) end it "redirects back to feature" do last_response.status.should be(302) last_response.headers["Location"].should eq("/features/search?error=Invalid+percentage+of+time+value%3A+value+must+be+a+positive+number+less+than+or+equal+to+100%2C+but+was+555") end end end end
Version data entries
8 entries across 8 versions & 1 rubygems