我從邁克爾·哈特爾書這個測試 describe "follower/following counts" do
let(:user) { FactoryGirl.create(:user) }
let(:other_user) { FactoryGirl.create(:user) }
before do
sign_in(user)
visit r
我正在使用rspec和rspec mocks庫進行存根/嘲弄,但我開始認爲將方法和斷言如何使用的方法之間的界限模糊不清。在我的測試中,我會經常寫這樣的: before(:each) do
subject.should_receive(:sum).once.with([1, 2, 3]).and_return(6)
end
it("should do something that r
context 'with event_type is available create event' do
let(:event_type) { EventType.where(name: 'visit_site').first }
assert_difference 'Event.count' do
Event.fire_event(event_type, @sp
我無法在循環中運行我的rspec示例。 describe "GET all providers" do
let(:current_user) { Factory(:user) }
[:twitter, :facebook, :google_oauth2].each do |provider|
before :each do
current_user.c