Sha256: 60a3d35a0733b827b233d63ade5b3e319779678f325943ea430921d55028925d

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

describe "scope" do
  extend WebStub::SpecHelpers
  
  it "should define a custom url" do
    Comment.should.respond_to :recent_url
  end
  
  it "should fetch collection" do
    stub_request(:get, "http://example.com/comments/recent.json").to_return(json: [{ id: 1, text: 'Whats up?' }])
    
    Comment.recent do |results|
      @results = results
      resume
    end
    
    wait_max 1.0 do
      @results.size.should == 1
      @results.first.text.should == 'Whats up?'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-resource-0.0.1 spec/motion-resource/associations/scope_spec.rb