spec/amfetamine/base_spec.rb in amfetamine-0.2.5 vs spec/amfetamine/base_spec.rb in amfetamine-0.2.6

- old
+ new

@@ -34,14 +34,16 @@ end context "#find" do it "should find dummy" do dummy.instance_variable_set('@notsaved', false) - stub_single_response(dummy) do - Dummy.find(dummy.id).should == dummy + Dummy.prevent_external_connections! do |r| + r.get { dummy } + response = Dummy.find(dummy.id) + response.should == dummy + response.should be_cached end - dummy.should be_cached end it "should return nil if object not found" do lambda { stub_nil_response do @@ -82,10 +84,11 @@ stub_post_response do new_dummy = Dummy.create({:title => 'test', :description => 'blabla'}) end new_dummy.should be_a(Dummy) new_dummy.should_not be_new + puts new_dummy.cache_key new_dummy.should be_cached end it "should return errors if data is incorrect" do new_dummy = nil @@ -102,15 +105,17 @@ before(:each) do dummy.send(:notsaved=, false) end it "should update if response is succesful" do - stub_update_response do + Dummy.prevent_external_connections! do |allowed| + allowed.put {} dummy.update_attributes({:title => 'zomg'}) end + dummy.should_not be_new dummy.title.should eq('zomg') - dummy.should be_cached + dummy.should be_cached end it "should show errors if response is not succesful" do stub_update_errornous_response do dummy.update_attributes({:title => ''})