Skip to content

Instantly share code, notes, and snippets.

@Lewy
Created January 12, 2011 12:26
Show Gist options
  • Save Lewy/776097 to your computer and use it in GitHub Desktop.
Save Lewy/776097 to your computer and use it in GitHub Desktop.
radar_bp.rb
require 'user'
Radar.blueprint {}
Radar.blueprint(:near_poznan3) do
full_message {Faker::Lorem.sentence(3)}
user {User.make(:warsaw)}
coords {[52.422418,16.903152]}
_type {Radar::Traffic}
created_at {Time.new(2008)}
end
describe Api::V01::MessagesController do
render_views
login_testuser
before(:each) do
@radar_traffic = Radar.make(:near_poznan3)
@params = {}
end
context 'fields' do
it 'should show only title' do
get :index, @params.merge(:fields => 'title')
assert_select 'message' do |msg|
msg.each do |attr|
assert_select attr, "title",1
end
end
end
it 'should show only title,body,tags' do
get :index, @params.merge(:fields => 'title,body,tags,intro')
assert_select "message" do |msg|
msg.each do |attr|
assert_select attr, "body", 1
assert_select attr, "title", 1
assert_select attr, "intro", 1
assert_select attr, "tags", 1
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment