fiveruns_tuneup_merb 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -3
- data/lib/fiveruns_tuneup_merb.rb +1 -1
- metadata +1 -6
- data/lib/fiveruns_tuneup_merb/spectasks.rb +0 -65
- data/spec/controllers/main_spec.rb +0 -61
- data/spec/fiveruns_tuneup_merb_spec.rb +0 -130
- data/spec/spec_helper.rb +0 -44
data/Rakefile
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake/gempackagetask'
|
3
|
-
require 'spec/rake/spectask'
|
4
3
|
require 'merb-core/version'
|
5
4
|
require 'merb-core/tasks/merb_rake_helper'
|
6
|
-
require 'merb-core/test/tasks/spectasks'
|
7
5
|
|
8
6
|
NAME = "fiveruns_tuneup_merb"
|
9
7
|
AUTHOR = "FiveRuns Development Team"
|
10
8
|
EMAIL = "dev@fiveruns.com"
|
11
9
|
HOMEPAGE = "http://tuneup.fiveruns.com/"
|
12
10
|
SUMMARY = "Merb Slice that provides the FiveRuns TuneUp Panel (http://tuneup.fiveruns.com)"
|
13
|
-
GEM_VERSION = "0.5.
|
11
|
+
GEM_VERSION = "0.5.1"
|
14
12
|
|
15
13
|
spec = Gem::Specification.new do |s|
|
16
14
|
s.rubyforge_project = 'fiveruns_tuneup_merb'
|
data/lib/fiveruns_tuneup_merb.rb
CHANGED
@@ -3,7 +3,7 @@ if defined?(Merb::Plugins)
|
|
3
3
|
$:.unshift File.dirname(__FILE__)
|
4
4
|
|
5
5
|
load_dependency 'merb-slices'
|
6
|
-
Merb::Plugins.add_rakefiles "fiveruns_tuneup_merb/merbtasks", "fiveruns_tuneup_merb/slicetasks"
|
6
|
+
Merb::Plugins.add_rakefiles "fiveruns_tuneup_merb/merbtasks", "fiveruns_tuneup_merb/slicetasks"
|
7
7
|
|
8
8
|
require 'fiveruns_tuneup_core'
|
9
9
|
require File.dirname(__FILE__) / 'fiveruns_tuneup_merb' / 'instrumentation'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiveruns_tuneup_merb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FiveRuns Development Team
|
@@ -52,12 +52,7 @@ files:
|
|
52
52
|
- lib/fiveruns_tuneup_merb/instrumentation.rb
|
53
53
|
- lib/fiveruns_tuneup_merb/merbtasks.rb
|
54
54
|
- lib/fiveruns_tuneup_merb/slicetasks.rb
|
55
|
-
- lib/fiveruns_tuneup_merb/spectasks.rb
|
56
55
|
- lib/fiveruns_tuneup_merb.rb
|
57
|
-
- spec/controllers
|
58
|
-
- spec/controllers/main_spec.rb
|
59
|
-
- spec/fiveruns_tuneup_merb_spec.rb
|
60
|
-
- spec/spec_helper.rb
|
61
56
|
- app/controllers
|
62
57
|
- app/controllers/application.rb
|
63
58
|
- app/controllers/runs.rb
|
@@ -1,65 +0,0 @@
|
|
1
|
-
namespace :slices do
|
2
|
-
namespace :fiveruns_tuneup_merb do
|
3
|
-
|
4
|
-
desc "Run slice specs within the host application context"
|
5
|
-
task :spec => [ "spec:explain", "spec:default" ]
|
6
|
-
|
7
|
-
namespace :spec do
|
8
|
-
|
9
|
-
slice_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
10
|
-
|
11
|
-
task :explain do
|
12
|
-
puts "\nNote: By running FiverunsTuneupMerb specs inside the application context any\n" +
|
13
|
-
"overrides could break existing specs. This isn't always a problem,\n" +
|
14
|
-
"especially in the case of views. Use these spec tasks to check how\n" +
|
15
|
-
"well your application conforms to the original slice implementation."
|
16
|
-
end
|
17
|
-
|
18
|
-
Spec::Rake::SpecTask.new('default') do |t|
|
19
|
-
t.spec_opts = ["--format", "specdoc", "--colour"]
|
20
|
-
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "Run all model specs, run a spec for a specific Model with MODEL=MyModel"
|
24
|
-
Spec::Rake::SpecTask.new('model') do |t|
|
25
|
-
t.spec_opts = ["--format", "specdoc", "--colour"]
|
26
|
-
if(ENV['MODEL'])
|
27
|
-
t.spec_files = Dir["#{slice_root}/spec/models/**/#{ENV['MODEL']}_spec.rb"].sort
|
28
|
-
else
|
29
|
-
t.spec_files = Dir["#{slice_root}/spec/models/**/*_spec.rb"].sort
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "Run all controller specs, run a spec for a specific Controller with CONTROLLER=MyController"
|
34
|
-
Spec::Rake::SpecTask.new('controller') do |t|
|
35
|
-
t.spec_opts = ["--format", "specdoc", "--colour"]
|
36
|
-
if(ENV['CONTROLLER'])
|
37
|
-
t.spec_files = Dir["#{slice_root}/spec/controllers/**/#{ENV['CONTROLLER']}_spec.rb"].sort
|
38
|
-
else
|
39
|
-
t.spec_files = Dir["#{slice_root}/spec/controllers/**/*_spec.rb"].sort
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
desc "Run all view specs, run specs for a specific controller (and view) with CONTROLLER=MyController (VIEW=MyView)"
|
44
|
-
Spec::Rake::SpecTask.new('view') do |t|
|
45
|
-
t.spec_opts = ["--format", "specdoc", "--colour"]
|
46
|
-
if(ENV['CONTROLLER'] and ENV['VIEW'])
|
47
|
-
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/#{ENV['VIEW']}*_spec.rb"].sort
|
48
|
-
elsif(ENV['CONTROLLER'])
|
49
|
-
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/*_spec.rb"].sort
|
50
|
-
else
|
51
|
-
t.spec_files = Dir["#{slice_root}/spec/views/**/*_spec.rb"].sort
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
desc "Run all specs and output the result in html"
|
56
|
-
Spec::Rake::SpecTask.new('html') do |t|
|
57
|
-
t.spec_opts = ["--format", "html"]
|
58
|
-
t.libs = ['lib', 'server/lib' ]
|
59
|
-
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe "FiverunsTuneupMerb::Main (controller)" do
|
4
|
-
|
5
|
-
# Feel free to remove the specs below
|
6
|
-
|
7
|
-
before :all do
|
8
|
-
Merb::Router.prepare { |r| r.add_slice(:FiverunsTuneupMerb) } if standalone?
|
9
|
-
end
|
10
|
-
|
11
|
-
after :all do
|
12
|
-
Merb::Router.reset! if standalone?
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should have access to the slice module" do
|
16
|
-
controller = dispatch_to(FiverunsTuneupMerb::Main, :index)
|
17
|
-
controller.slice.should == FiverunsTuneupMerb
|
18
|
-
controller.slice.should == FiverunsTuneupMerb::Main.slice
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have an index action" do
|
22
|
-
controller = dispatch_to(FiverunsTuneupMerb::Main, :index)
|
23
|
-
controller.status.should == 200
|
24
|
-
controller.body.should contain('FiverunsTuneupMerb')
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should work with the default route" do
|
28
|
-
controller = get("/fiveruns_tuneup_merb/main/index")
|
29
|
-
controller.should be_kind_of(FiverunsTuneupMerb::Main)
|
30
|
-
controller.action_name.should == 'index'
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should work with the example named route" do
|
34
|
-
controller = get("/fiveruns_tuneup_merb/index.html")
|
35
|
-
controller.should be_kind_of(FiverunsTuneupMerb::Main)
|
36
|
-
controller.action_name.should == 'index'
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should have routes in FiverunsTuneupMerb.routes" do
|
40
|
-
FiverunsTuneupMerb.routes.should_not be_empty
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should have a slice_url helper method for slice-specific routes" do
|
44
|
-
controller = dispatch_to(FiverunsTuneupMerb::Main, 'index')
|
45
|
-
controller.slice_url(:action => 'show', :format => 'html').should == "/fiveruns_tuneup_merb/main/show.html"
|
46
|
-
controller.slice_url(:fiveruns_tuneup_merb_index, :format => 'html').should == "/fiveruns_tuneup_merb/index.html"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should have helper methods for dealing with public paths" do
|
50
|
-
controller = dispatch_to(FiverunsTuneupMerb::Main, :index)
|
51
|
-
controller.public_path_for(:image).should == "/slices/fiveruns_tuneup_merb/images"
|
52
|
-
controller.public_path_for(:javascript).should == "/slices/fiveruns_tuneup_merb/javascripts"
|
53
|
-
controller.public_path_for(:stylesheet).should == "/slices/fiveruns_tuneup_merb/stylesheets"
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should have a slice-specific _template_root" do
|
57
|
-
FiverunsTuneupMerb::Main._template_root.should == FiverunsTuneupMerb.dir_for(:view)
|
58
|
-
FiverunsTuneupMerb::Main._template_root.should == FiverunsTuneupMerb::Application._template_root
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
3
|
-
describe "FiverunsTuneupMerb (module)" do
|
4
|
-
|
5
|
-
it "should have proper specs"
|
6
|
-
|
7
|
-
# Feel free to remove the specs below
|
8
|
-
|
9
|
-
before :all do
|
10
|
-
Merb::Router.prepare { |r| r.add_slice(:FiverunsTuneupMerb) } if standalone?
|
11
|
-
end
|
12
|
-
|
13
|
-
after :all do
|
14
|
-
Merb::Router.reset! if standalone?
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should be registered in Merb::Slices.slices" do
|
18
|
-
Merb::Slices.slices.should include(FiverunsTuneupMerb)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should be registered in Merb::Slices.paths" do
|
22
|
-
Merb::Slices.paths[FiverunsTuneupMerb.name].should == current_slice_root
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have an :identifier property" do
|
26
|
-
FiverunsTuneupMerb.identifier.should == "fiveruns_tuneup_merb"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have an :identifier_sym property" do
|
30
|
-
FiverunsTuneupMerb.identifier_sym.should == :fiveruns_tuneup_merb
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have a :root property" do
|
34
|
-
FiverunsTuneupMerb.root.should == Merb::Slices.paths[FiverunsTuneupMerb.name]
|
35
|
-
FiverunsTuneupMerb.root_path('app').should == current_slice_root / 'app'
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should have a :file property" do
|
39
|
-
FiverunsTuneupMerb.file.should == current_slice_root / 'lib' / 'fiveruns_tuneup_merb.rb'
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should have metadata properties" do
|
43
|
-
FiverunsTuneupMerb.description.should == "FiverunsTuneupMerb is a chunky Merb slice!"
|
44
|
-
FiverunsTuneupMerb.version.should == "0.0.1"
|
45
|
-
FiverunsTuneupMerb.author.should == "YOUR NAME"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should have :routes and :named_routes properties" do
|
49
|
-
FiverunsTuneupMerb.routes.should_not be_empty
|
50
|
-
FiverunsTuneupMerb.named_routes[:fiveruns_tuneup_merb_index].should be_kind_of(Merb::Router::Route)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should have an url helper method for slice-specific routes" do
|
54
|
-
FiverunsTuneupMerb.url(:controller => 'main', :action => 'show', :format => 'html').should == "/fiveruns_tuneup_merb/main/show.html"
|
55
|
-
FiverunsTuneupMerb.url(:fiveruns_tuneup_merb_index, :format => 'html').should == "/fiveruns_tuneup_merb/index.html"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should have a config property (Hash)" do
|
59
|
-
FiverunsTuneupMerb.config.should be_kind_of(Hash)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should have bracket accessors as shortcuts to the config" do
|
63
|
-
FiverunsTuneupMerb[:foo] = 'bar'
|
64
|
-
FiverunsTuneupMerb[:foo].should == 'bar'
|
65
|
-
FiverunsTuneupMerb[:foo].should == FiverunsTuneupMerb.config[:foo]
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should have a :layout config option set" do
|
69
|
-
FiverunsTuneupMerb.config[:layout].should == :fiveruns_tuneup_merb
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should have a dir_for method" do
|
73
|
-
app_path = FiverunsTuneupMerb.dir_for(:application)
|
74
|
-
app_path.should == current_slice_root / 'app'
|
75
|
-
[:view, :model, :controller, :helper, :mailer, :part].each do |type|
|
76
|
-
FiverunsTuneupMerb.dir_for(type).should == app_path / "#{type}s"
|
77
|
-
end
|
78
|
-
public_path = FiverunsTuneupMerb.dir_for(:public)
|
79
|
-
public_path.should == current_slice_root / 'public'
|
80
|
-
[:stylesheet, :javascript, :image].each do |type|
|
81
|
-
FiverunsTuneupMerb.dir_for(type).should == public_path / "#{type}s"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should have a app_dir_for method" do
|
86
|
-
root_path = FiverunsTuneupMerb.app_dir_for(:root)
|
87
|
-
root_path.should == Merb.root / 'slices' / 'fiveruns_tuneup_merb'
|
88
|
-
app_path = FiverunsTuneupMerb.app_dir_for(:application)
|
89
|
-
app_path.should == root_path / 'app'
|
90
|
-
[:view, :model, :controller, :helper, :mailer, :part].each do |type|
|
91
|
-
FiverunsTuneupMerb.app_dir_for(type).should == app_path / "#{type}s"
|
92
|
-
end
|
93
|
-
public_path = FiverunsTuneupMerb.app_dir_for(:public)
|
94
|
-
public_path.should == Merb.dir_for(:public) / 'slices' / 'fiveruns_tuneup_merb'
|
95
|
-
[:stylesheet, :javascript, :image].each do |type|
|
96
|
-
FiverunsTuneupMerb.app_dir_for(type).should == public_path / "#{type}s"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should have a public_dir_for method" do
|
101
|
-
public_path = FiverunsTuneupMerb.public_dir_for(:public)
|
102
|
-
public_path.should == '/slices' / 'fiveruns_tuneup_merb'
|
103
|
-
[:stylesheet, :javascript, :image].each do |type|
|
104
|
-
FiverunsTuneupMerb.public_dir_for(type).should == public_path / "#{type}s"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should have a public_path_for method" do
|
109
|
-
public_path = FiverunsTuneupMerb.public_dir_for(:public)
|
110
|
-
FiverunsTuneupMerb.public_path_for("path", "to", "file").should == public_path / "path" / "to" / "file"
|
111
|
-
[:stylesheet, :javascript, :image].each do |type|
|
112
|
-
FiverunsTuneupMerb.public_path_for(type, "path", "to", "file").should == public_path / "#{type}s" / "path" / "to" / "file"
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should have a app_path_for method" do
|
117
|
-
FiverunsTuneupMerb.app_path_for("path", "to", "file").should == FiverunsTuneupMerb.app_dir_for(:root) / "path" / "to" / "file"
|
118
|
-
FiverunsTuneupMerb.app_path_for(:controller, "path", "to", "file").should == FiverunsTuneupMerb.app_dir_for(:controller) / "path" / "to" / "file"
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should have a slice_path_for method" do
|
122
|
-
FiverunsTuneupMerb.slice_path_for("path", "to", "file").should == FiverunsTuneupMerb.dir_for(:root) / "path" / "to" / "file"
|
123
|
-
FiverunsTuneupMerb.slice_path_for(:controller, "path", "to", "file").should == FiverunsTuneupMerb.dir_for(:controller) / "path" / "to" / "file"
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should keep a list of path component types to use when copying files" do
|
127
|
-
(FiverunsTuneupMerb.mirrored_components & FiverunsTuneupMerb.slice_paths.keys).length.should == FiverunsTuneupMerb.mirrored_components.length
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'merb-core'
|
3
|
-
require 'merb-slices'
|
4
|
-
require 'spec'
|
5
|
-
|
6
|
-
# Add fiveruns_tuneup_merb.rb to the search path
|
7
|
-
Merb::Plugins.config[:merb_slices][:auto_register] = true
|
8
|
-
Merb::Plugins.config[:merb_slices][:search_path] = File.join(File.dirname(__FILE__), '..', 'lib', 'fiveruns_tuneup_merb.rb')
|
9
|
-
|
10
|
-
# Using Merb.root below makes sure that the correct root is set for
|
11
|
-
# - testing standalone, without being installed as a gem and no host application
|
12
|
-
# - testing from within the host application; its root will be used
|
13
|
-
Merb.start_environment(
|
14
|
-
:testing => true,
|
15
|
-
:adapter => 'runner',
|
16
|
-
:environment => ENV['MERB_ENV'] || 'test',
|
17
|
-
:merb_root => Merb.root,
|
18
|
-
:session_store => 'memory'
|
19
|
-
)
|
20
|
-
|
21
|
-
module Merb
|
22
|
-
module Test
|
23
|
-
module SliceHelper
|
24
|
-
|
25
|
-
# The absolute path to the current slice
|
26
|
-
def current_slice_root
|
27
|
-
@current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
28
|
-
end
|
29
|
-
|
30
|
-
# Whether the specs are being run from a host application or standalone
|
31
|
-
def standalone?
|
32
|
-
Merb.root == ::FiverunsTuneupMerb.root
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
Spec::Runner.configure do |config|
|
40
|
-
config.include(Merb::Test::ViewHelper)
|
41
|
-
config.include(Merb::Test::RouteHelper)
|
42
|
-
config.include(Merb::Test::ControllerHelper)
|
43
|
-
config.include(Merb::Test::SliceHelper)
|
44
|
-
end
|