spec/flipper/ui/action_spec.rb in flipper-ui-0.10.2 vs spec/flipper/ui/action_spec.rb in flipper-ui-0.11.0.beta1
- old
+ new
@@ -1,59 +1,59 @@
require 'helper'
RSpec.describe Flipper::UI::Action do
- let(:action_subclass) {
+ let(:action_subclass) do
Class.new(described_class) do
def noooope
- raise "should never run this"
+ raise 'should never run this'
end
def get
- [200, {}, "get"]
+ [200, {}, 'get']
end
def post
- [200, {}, "post"]
+ [200, {}, 'post']
end
def put
- [200, {}, "put"]
+ [200, {}, 'put']
end
def delete
- [200, {}, "delete"]
+ [200, {}, 'delete']
end
end
- }
+ end
it "won't run method that isn't whitelisted" do
- fake_request = Struct.new(:request_method, :env, :session).new("NOOOOPE", {}, {})
+ fake_request = Struct.new(:request_method, :env, :session).new('NOOOOPE', {}, {})
action = action_subclass.new(flipper, fake_request)
- expect {
+ expect do
action.run
- }.to raise_error(Flipper::UI::RequestMethodNotSupported)
+ end.to raise_error(Flipper::UI::RequestMethodNotSupported)
end
- it "will run get" do
- fake_request = Struct.new(:request_method, :env, :session).new("GET", {}, {})
+ it 'will run get' do
+ fake_request = Struct.new(:request_method, :env, :session).new('GET', {}, {})
action = action_subclass.new(flipper, fake_request)
- expect(action.run).to eq([200, {}, "get"])
+ expect(action.run).to eq([200, {}, 'get'])
end
- it "will run post" do
- fake_request = Struct.new(:request_method, :env, :session).new("POST", {}, {})
+ it 'will run post' do
+ fake_request = Struct.new(:request_method, :env, :session).new('POST', {}, {})
action = action_subclass.new(flipper, fake_request)
- expect(action.run).to eq([200, {}, "post"])
+ expect(action.run).to eq([200, {}, 'post'])
end
- it "will run put" do
- fake_request = Struct.new(:request_method, :env, :session).new("PUT", {}, {})
+ it 'will run put' do
+ fake_request = Struct.new(:request_method, :env, :session).new('PUT', {}, {})
action = action_subclass.new(flipper, fake_request)
- expect(action.run).to eq([200, {}, "put"])
+ expect(action.run).to eq([200, {}, 'put'])
end
- it "will run delete" do
- fake_request = Struct.new(:request_method, :env, :session).new("DELETE", {}, {})
+ it 'will run delete' do
+ fake_request = Struct.new(:request_method, :env, :session).new('DELETE', {}, {})
action = action_subclass.new(flipper, fake_request)
- expect(action.run).to eq([200, {}, "delete"])
+ expect(action.run).to eq([200, {}, 'delete'])
end
end