Sha256: 44d175c0f5bff4dd2282b1888ad048dce5dc87d45d35c99905234c9f213ffb15

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

def assert_watched_routes_include(controller, action, method)
  begin
    routes = YAML.load_file(RouteDog.config_file)
    raise if !routes[controller.to_s][action.to_s].include?(method.to_s)
    raise if routes[controller.to_s][action.to_s].reject {|e| e != method.to_s}.size != 1
  rescue
    assert false, "Expected Watched Routes To Include {:controller => :#{controller}, :action => :#{action}, :method => :#{method}} Only One Time."
  end
end

def assert_watched_routes_not_include(controller, action, method = :get)
  begin
    routes = YAML.load_file(RouteDog::Middleware::RouteDog.config_file)
    routes[controller.to_s][action.to_s].include?(method.to_s)
    assert false
  rescue Test::Unit::AssertionFailedError
    assert false, "Expected Watched Routes To Not include {:controller => :#{controller}, :action => :#{action}, :method => :#{method}}."
  rescue
    assert true
  end
end

def assert_notify_for(controller, action, method = :get)
  html_notification = Nokogiri::HTML(response.body).search('div#route_dog_warning')
  assert html_notification.any?, "Expected {:controller => :#{controller}, :action => :#{action}, :method => :#{method}} Notify That The Route Has Not Tests"
end

def assert_not_notify_for(controller, action, method = :get)
  html_notification = Nokogiri::HTML(response.body).search('div#route_dog_warning')
  assert !html_notification.any?, "Expected {:controller => :#{controller}, :action => :#{action}, :method => :#{method}} To Not Notify That The Route Has Not Tests"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
route_dog-2.3.0 test/support/assertions.rb
route_dog-2.2.0 test/support/assertions.rb