Skip to content

Instantly share code, notes, and snippets.

@tomdepplito
Created October 30, 2012 21:20
Show Gist options
  • Save tomdepplito/3983150 to your computer and use it in GitHub Desktop.
Save tomdepplito/3983150 to your computer and use it in GitHub Desktop.
utils_spec.rb
context '#ban_devices' do
before :each do
@device1 = FactoryGirl.create(:device)
device2 = FactoryGirl.create(:device)
click1 = FactoryGirl.create(:click, :udid => @device1.id)
click2 = FactoryGirl.create(:click, :udid => device2.id)
notes = {'date' => '10/24/12', 'reason' => 'fraud'}
@click_hash = {click1.id => notes, click2.id => notes}
@num_banned = Utils.ban_devices(@click_hash)
end
it "should find and ban a device when passed a Click ID" do
Device.find(@device1.id).banned.should == true
end
it "should find and ban multiple devices when passed a hash of Click IDs" do
@num_banned.should eq @click_hash.length
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment