Sha256: 5cb0cda6efc10bc3d9fbc2d33a55eef2ccce75a8786ce5bc171020e2f70496c4
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
RSpec.describe Aldous::Controller::PreconditionsExecutionService do let(:preconditions_execution_service) {described_class.new(action_wrapper, controller)} let(:controller) {double "controller"} let(:action_wrapper) {double 'action wrapper', preconditions: preconditions, controller_action: action} let(:action) {double 'action', view_builder: view_builder} let(:view_builder) {double 'view_builder'} let(:preconditions) { [] } describe "#perform" do subject(:perform) {preconditions_execution_service.perform} context "when no preconditions defined" do it "returns an array of nils" do expect(perform).to eq [nil, nil] end end context "when preconditions defined" do let(:preconditions) { [precondition_class] } let(:precondition_class) {double 'precondition_class', build: precondition} let(:precondition) {double "precondition", perform: nil} it "builds the precondition with the controller_action" do expect(precondition_class).to receive(:build).with(action, controller, view_builder) perform end context "but they don't short-circuit execution" do it "returns an array of nils" do expect(perform).to eq [nil, nil] end end context "and they short-circuit execution" do let(:precondition) {double "precondition", perform: precondition_result} let(:precondition_result) {Aldous::Respondable::Renderable.new(nil, nil, nil)} it "returns an array of precondition and precondition result" do expect(perform).to eq [precondition, precondition_result] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aldous-1.1.3 | spec/aldous/controller/preconditions_execution_service_spec.rb |
aldous-1.1.2 | spec/aldous/controller/preconditions_execution_service_spec.rb |