magic_smoke 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in magic_smoke.gemspec
4
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,15 @@
1
+ Magic Smoke
2
+ ===========
3
+
4
+ A magical test suite for your rails app.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ gem install magic_smoke
10
+
11
+ How does it work?
12
+ -----------------
13
+
14
+ 1. Reads your app's routes
15
+ 2. Check all GET requests return 200s
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,10 @@
1
+ require 'magic_smoke'
2
+ require 'rails'
3
+
4
+ module MagicSmoke
5
+ class Railtie < Rails::Railtie
6
+ rake_tasks do
7
+ load "tasks/magic_smoke.rake"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module MagicSmoke
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ module MagicSmoke
2
+ require 'magic_smoke/railtie' if defined?(Rails)
3
+ end
@@ -0,0 +1,41 @@
1
+ require File.expand_path('config/environment', Rails.application.paths.path.to_s)
2
+ require 'rake'
3
+
4
+ #config
5
+ CONFIG = <<-DSL
6
+
7
+ DSL
8
+
9
+ class Routes
10
+ class << self
11
+ def all
12
+ Rails.application.reload_routes!
13
+ @all ||= Rails.application.routes.routes
14
+ @all.map { |r| r.path.gsub!("(.:format)", ""); r }
15
+ end
16
+
17
+ def get_requests
18
+ all.select { |r| r.verb == "GET" || r.verb.blank? }
19
+ end
20
+
21
+ def get_requests_with_no_params
22
+ get_requests.reject { |r| r.path =~ /:/ }
23
+ end
24
+ end
25
+ end
26
+
27
+ desc 'A magical smoke test suite'
28
+ namespace :magic_smoke do
29
+
30
+ desc 'Tests all the GET requests with no parameters in your routes'
31
+ task :routes => :environment do
32
+
33
+ puts "Testing GETs..."
34
+ # ap Routes.get_requests_with_no_params
35
+ Routes.get_requests_with_no_params.each do |route|
36
+ response = Rails.application.call(Rack::MockRequest.env_for("http://localhost/#{route.path}"))
37
+ puts "#{response[0]} #{route.path}"
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "magic_smoke/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "magic_smoke"
7
+ s.version = MagicSmoke::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Josh Price", "Matt Allen"]
10
+ s.email = ["josh@canoniq.com", "matt@devlogic.com.au"]
11
+ s.homepage = "http://github.com/joshprice/magic_smoke"
12
+ s.summary = %q{A magical smoke test suite for your rails app}
13
+ s.description = %q{Checks that no routes in your app break}
14
+
15
+ s.rubyforge_project = "magic_smoke"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: magic_smoke
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Josh Price
9
+ - Matt Allen
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2011-06-29 00:00:00 Z
15
+ dependencies: []
16
+
17
+ description: Checks that no routes in your app break
18
+ email:
19
+ - josh@canoniq.com
20
+ - matt@devlogic.com.au
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files: []
26
+
27
+ files:
28
+ - .gitignore
29
+ - Gemfile
30
+ - README.markdown
31
+ - Rakefile
32
+ - lib/magic_smoke.rb
33
+ - lib/magic_smoke/railtie.rb
34
+ - lib/magic_smoke/version.rb
35
+ - lib/tasks/magic_smoke.rake
36
+ - magic_smoke.gemspec
37
+ homepage: http://github.com/joshprice/magic_smoke
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ requirements: []
58
+
59
+ rubyforge_project: magic_smoke
60
+ rubygems_version: 1.7.2
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: A magical smoke test suite for your rails app
64
+ test_files: []
65
+