Created
January 12, 2011 12:26
-
-
Save Lewy/776097 to your computer and use it in GitHub Desktop.
radar_bp.rb
This file contains 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
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 |
This file contains 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 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