forked from apneadiving/Google-Maps-for-Rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some changes in partial + view tests
- Loading branch information
1 parent
7bc8625
commit 5334105
Showing
10 changed files
with
111 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ GIT | |
PATH | ||
remote: ../../ | ||
specs: | ||
gmaps4rails (1.0.0) | ||
gmaps4rails (1.0.1) | ||
crack | ||
|
||
GEM | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
<%= gmaps(:markers => {:data => @json, :options => {:do_clustering => true, :draggable => true } }, | ||
:last_map => false) %> | ||
<%= gmaps(:markers => {:data => '[{ "lng": "5.9311119", "lat": "43.1251606"} ,{ "lng": "2.3509871", "lat": "48.8566667" },{ "lng": "0", "lat": "0" } ]', | ||
"options" => {"do_clustering" => true, "draggable" => true } }, | ||
:map_options => { :id => "custom_id", :class => "custom_class", :container_class => "custom_container" }, | ||
:scripts => "none", | ||
:last_map => false ) %> | ||
<%= gmaps(:markers => {:data => @json, :options => {:do_clustering => false, :draggable => true } }, | ||
:map_options => { :auto_adjust => true, :center_on_user => true, :zoom => 5, :provider => "openlayers", :id => "joe" }, | ||
:scripts => "api", | ||
:last_map => false ) %> | ||
<%= gmaps(:markers => {:data => @json, :options => {:do_clustering => false, :draggable => true } }, | ||
:map_options => { :auto_adjust => true, :center_on_user => true, :zoom => 5, :id => "joe3", :provider => "mapquest", :provider_key => MAPQUEST_KEY }, | ||
:scripts => "api", | ||
:last_map => false ) %> | ||
<div id="bing"> | ||
<%= gmaps(:markers => {"data" => @json, :options => {:do_clustering => false, :draggable => true } }, | ||
:map_options => { :auto_adjust => true, :center_on_user => true, :zoom => 5, :id => "foo", :provider => "bing", :provider_key => BING_KEY }, | ||
:scripts => "api" ) %> | ||
</div> |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
require File.dirname(__FILE__) + '/../../spec_helper' | ||
|
||
describe "users/test_partial.html.erb" do | ||
before(:each) do | ||
Factory :user | ||
Factory :user_paris | ||
assigns[:json] = User.all.to_gmaps4rails | ||
render | ||
end | ||
|
||
it "should contain proper default div properties" do | ||
rendered.should have_selector('div.map_container') do | ||
with_tag('div#map') | ||
with_tag('div.gmaps4rails') | ||
end | ||
end | ||
|
||
it "should render proper customized ids and class" do | ||
rendered.should have_selector('div.custom_container') do | ||
with_tag('div#custom_id') | ||
with_tag('div.custom_class') | ||
end | ||
end | ||
|
||
it "should display proper bing's map default class" do | ||
rendered.should have_selector('div#bing') do | ||
with_tag('div#foo') | ||
with_tag('div.bing_map') | ||
end | ||
end | ||
|
||
context "content_for content" do | ||
|
||
before(:each) do | ||
#hack to access attr_readers | ||
self.instance_eval do | ||
def get_partials; @partials; end | ||
end | ||
view.instance_eval do | ||
def get_content_for; @_content_for; end | ||
end | ||
end | ||
|
||
it "partial should have been inserted 5 times" do | ||
get_partials["_gmaps4rails"].should eq 5 | ||
end | ||
|
||
it "all scripts should have only be inserted once" do | ||
[ | ||
/http:\/\/maps.google.com\/maps\/api\/js/, | ||
/http:\/\/www.openlayers.org\/api/, | ||
/http:\/\/mapquestapi.com\/sdk\/js/, | ||
/http:\/\/ecn.dev.virtualearth.net/, | ||
/gmaps4rails.base.js/, | ||
/gmaps4rails.googlemaps.js/, | ||
/gmaps4rails.mapquest.js/, | ||
/gmaps4rails.bing.js/, | ||
/gmaps4rails.openlayers.js/ | ||
].each do |regexp| | ||
view.get_content_for[:scripts].scan(regexp).size.should eq 1 | ||
end | ||
end | ||
|
||
it "css should only be inserted once" do | ||
view.get_content_for[:head].scan(/stylesheets\/gmaps4rails.css/).size.should eq 1 | ||
end | ||
end | ||
|
||
end |