Skip to content

Commit

Permalink
Fixed tests for Javascript maps
Browse files Browse the repository at this point in the history
  • Loading branch information
jferris committed Oct 19, 2008
1 parent 45c2c0a commit 35d3f58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/functional/stores_controller_test.rb
Expand Up @@ -47,7 +47,7 @@ class StoresControllerTest < ActionController::TestCase
get :index
end

should_have_map
should_have_store_map
should_assign_to :stores

should "only display 4 stores" do
Expand Down
10 changes: 9 additions & 1 deletion test/shoulda_macros/should_have_map.rb
Expand Up @@ -24,4 +24,12 @@ def self.should_have_map_observer(field)
@response.body
end
end
end

def self.should_have_store_map
should "have a map displaying stores" do
json = Regexp.escape(assigns(:stores).to_json)
assert_match /new StoreViewer\(\{.*mapContainer:.*,.*stores: *#{json}.*\}.*\)/m,
@response.body
end
end
end

0 comments on commit 35d3f58

Please sign in to comment.