Created
February 14, 2012 20:46
-
-
Save supaspoida/1830240 to your computer and use it in GitHub Desktop.
How I'd express the donors choose spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe DonorsChoose do | |
describe "requesting data" do | |
let(:test_title) { "A test project" } | |
def mock_request(args) | |
request = double(:fetch => %Q/{"proposals": [{"title": "#{test_title}"}]}/) | |
DonorsChoose::Request.should_receive(:new).with(args).and_return(request) | |
end | |
context "via lat & lng" do | |
subject do | |
described_class.projects_near_me("40.4405556", "-79.9961111") | |
end | |
before do | |
mock_request(:centerLat => "40.4405556", :centerLong => "-79.9961111") | |
end | |
it { should include_project 'A test project' } | |
end | |
context "via zip code" do | |
subject do | |
described_class.projects_by_zip("15232") | |
end | |
before do | |
mock_request(:keyword => "15232") | |
end | |
it { should include_project 'A test project' } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment