valid" do let(:params) { {:name => "Andy"} } let(:user) { double } before { allow(User).to receive(:new) { user } } it "saves the user" do expect(user).to receive(:save) { true } subject.register(params) end it "returns :saved" do allow(user).to receive(:save) { true } expect(subject.register(params)).to eq(:saved) end end end end
valid" do let(:params) { {:name => "Andy"} } let(:user) { double } before { allow(User).to receive(:new) { user } } it "saves the user" do expect(user).to receive(:save) { true } subject.register(params) end it "returns :saved" do allow(user).to receive(:save) { true } expect(subject.register(params)).to eq(:saved) end end end end
of 1..15" do list = %w(1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz) it "returns #{list}" do expect(subject.build_list(1..15)).to eq(list) end end end end
}.each do |n| processors.each do |processor| processor.new(list, n).process end end end end def processors [ FizzBuzzProcessor, FizzProcessor, BuzzProcessor, DefaultProcessor ] end end
valid" do let(:params) { {:name => "Andy"} } let(:user) { double } before { allow(User).to receive(:new) { user } } it "saves the user" do expect(user).to receive(:save) { true } subject.register(params) end it "returns :saved" do allow(user).to receive(:save) { true } expect(subject.register(params)).to eq(:saved) end end end end
valid" do let(:params) { {:name => "Andy"} } it "saves the user" do subject.register(params) expect(User.count).to eq(1) end it "returns :saved" do expect(subject.register(params)).to eq(:saved) end end end end