drogus-blue-ridge 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/LICENSE-Screw.Unit +22 -0
- data/LICENSE-Smoke +22 -0
- data/README.markdown +256 -0
- data/Rakefile +65 -0
- data/VERSION +1 -0
- data/blue_ridge_generators/blue_ridge/USAGE +5 -0
- data/blue_ridge_generators/blue_ridge/blue_ridge_generator.rb +19 -0
- data/blue_ridge_generators/blue_ridge/templates/application.html +16 -0
- data/blue_ridge_generators/blue_ridge/templates/application_spec.js +15 -0
- data/blue_ridge_generators/blue_ridge/templates/javascript_spec_helper.rb +44 -0
- data/blue_ridge_generators/blue_ridge/templates/screw.css +90 -0
- data/blue_ridge_generators/blue_ridge/templates/spec_helper.js +1 -0
- data/blue_ridge_generators/javascript_spec/USAGE +5 -0
- data/blue_ridge_generators/javascript_spec/javascript_spec_generator.rb +52 -0
- data/blue_ridge_generators/javascript_spec/templates/fixture.html.erb +13 -0
- data/blue_ridge_generators/javascript_spec/templates/fixture_render_spec.rb.erb +10 -0
- data/blue_ridge_generators/javascript_spec/templates/javascript_spec.js.erb +10 -0
- data/lib/blue-ridge.js +73 -0
- data/lib/consoleReportForRake.js +32 -0
- data/lib/env.rhino.js +8841 -0
- data/lib/jquery-1.2.6.js +3549 -0
- data/lib/jquery-1.3.2.js +4376 -0
- data/lib/jquery.fn.js +29 -0
- data/lib/jquery.print.js +109 -0
- data/lib/js.jar +0 -0
- data/lib/screw.behaviors.js +92 -0
- data/lib/screw.builder.js +82 -0
- data/lib/screw.events.js +45 -0
- data/lib/screw.matchers.js +187 -0
- data/lib/screw.mocking.js +26 -0
- data/lib/shell.js +27 -0
- data/lib/smoke.core.js +49 -0
- data/lib/smoke.mock.js +171 -0
- data/lib/smoke.stub.js +29 -0
- data/lib/test_runner.js +58 -0
- data/spec/fixtures/rails_project/app/controllers/accounts_controller.rb +85 -0
- data/spec/fixtures/rails_project/app/controllers/application_controller.rb +10 -0
- data/spec/fixtures/rails_project/app/controllers/home_controller.rb +5 -0
- data/spec/fixtures/rails_project/app/helpers/accounts_helper.rb +2 -0
- data/spec/fixtures/rails_project/app/helpers/application_helper.rb +13 -0
- data/spec/fixtures/rails_project/app/helpers/home_helper.rb +2 -0
- data/spec/fixtures/rails_project/app/models/account.rb +3 -0
- data/spec/fixtures/rails_project/config/boot.rb +110 -0
- data/spec/fixtures/rails_project/config/environment.rb +41 -0
- data/spec/fixtures/rails_project/config/environments/cucumber.rb +25 -0
- data/spec/fixtures/rails_project/config/environments/development.rb +17 -0
- data/spec/fixtures/rails_project/config/environments/production.rb +28 -0
- data/spec/fixtures/rails_project/config/environments/test.rb +35 -0
- data/spec/fixtures/rails_project/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails_project/config/initializers/inflections.rb +10 -0
- data/spec/fixtures/rails_project/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails_project/config/initializers/new_rails_defaults.rb +19 -0
- data/spec/fixtures/rails_project/config/initializers/session_store.rb +2 -0
- data/spec/fixtures/rails_project/config/routes.rb +47 -0
- data/spec/fixtures/rails_project/db/migrate/20090719005327_create_sessions.rb +16 -0
- data/spec/fixtures/rails_project/db/migrate/20090719031606_create_accounts.rb +13 -0
- data/spec/fixtures/rails_project/db/schema.rb +30 -0
- data/spec/fixtures/rails_project/spec/spec_helper.rb +52 -0
- data/tasks/javascript_testing_tasks.rake +84 -0
- data/test/test_blue_ridge_generator.rb +48 -0
- data/test/test_generator_helper.rb +29 -0
- data/test/test_javascript_spec_generator.rb +57 -0
- metadata +148 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
// This is a lightweight bridge between Smoke and Screw.Unit.
|
2
|
+
// It shadows mocking and stubbing onto the matchers to make them available within tests.
|
3
|
+
|
4
|
+
Screw.Matchers.mock = function(m) {
|
5
|
+
return Smoke.Mock(m);
|
6
|
+
};
|
7
|
+
|
8
|
+
Screw.Matchers.mock_function = function(func,name) {
|
9
|
+
return Smoke.MockFunction(func,name);
|
10
|
+
};
|
11
|
+
|
12
|
+
Screw.Matchers.stub = function(obj, attr) {
|
13
|
+
return new Smoke.Stub(obj,attr);
|
14
|
+
};
|
15
|
+
|
16
|
+
(function($) {
|
17
|
+
$(Screw).bind("before", function(){
|
18
|
+
function checkAndResetSmoke() {
|
19
|
+
Smoke.checkExpectations();
|
20
|
+
Smoke.reset();
|
21
|
+
}
|
22
|
+
|
23
|
+
$('.it').bind('passed', function(){ checkAndResetSmoke() });
|
24
|
+
$('.it').bind('failed', function(){ checkAndResetSmoke() });
|
25
|
+
});
|
26
|
+
})(jQuery);
|
data/lib/shell.js
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
(function(){
|
2
|
+
var _old_quit = this.quit;
|
3
|
+
this.__defineGetter__("exit", function(){ _old_quit() });
|
4
|
+
this.__defineGetter__("quit", function(){ _old_quit() });
|
5
|
+
|
6
|
+
print("=================================================");
|
7
|
+
print(" Rhino JavaScript Shell");
|
8
|
+
print(" To exit type 'exit', 'quit', or 'quit()'.");
|
9
|
+
print("=================================================");
|
10
|
+
|
11
|
+
var plugin_prefix = environment["blue.ridge.prefix"] || "vendor/plugins/blue-ridge";
|
12
|
+
var fixture_file = plugin_prefix + "/generators/blue_ridge/templates/application.html";
|
13
|
+
|
14
|
+
load(plugin_prefix + "/lib/env.rhino.js");
|
15
|
+
print(" - loaded env.js");
|
16
|
+
|
17
|
+
window.location = fixture_file;
|
18
|
+
print(" - sample DOM loaded");
|
19
|
+
|
20
|
+
load(plugin_prefix + "/lib/jquery-1.3.2.js");
|
21
|
+
print(" - jQuery-1.3.2 loaded");
|
22
|
+
|
23
|
+
load(plugin_prefix + "/lib/jquery.print.js");
|
24
|
+
print(" - jQuery print lib loaded");
|
25
|
+
|
26
|
+
print("=================================================");
|
27
|
+
})();
|
data/lib/smoke.core.js
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
Smoke = {
|
2
|
+
print: function(v) {
|
3
|
+
// use the jquery print plugin if it is available or fall back to toString();
|
4
|
+
return (jQuery && jQuery.print) ? jQuery.print(v) : v.toString();
|
5
|
+
},
|
6
|
+
|
7
|
+
printArguments: function(args) {
|
8
|
+
var a = [];
|
9
|
+
if (args === undefined) args = '';
|
10
|
+
if ((args && args.callee) || (args instanceof Array)) {
|
11
|
+
for(var i = 0; i < args.length; i++) {
|
12
|
+
a.push(Smoke.print(args[i]));
|
13
|
+
}
|
14
|
+
} else {
|
15
|
+
// Workaround for jQuery.print returning "null" when called with an empty string.
|
16
|
+
if (!args && (typeof args == 'string')) {
|
17
|
+
a.push('');
|
18
|
+
} else {
|
19
|
+
a.push(Smoke.print(args));
|
20
|
+
}
|
21
|
+
}
|
22
|
+
return '(' + a.join(', ') + ')';
|
23
|
+
},
|
24
|
+
|
25
|
+
argumentsToArray: function(args) {
|
26
|
+
return Array.prototype.slice.call(args);
|
27
|
+
},
|
28
|
+
|
29
|
+
compare: function(a, b) {
|
30
|
+
if (a === b) return true;
|
31
|
+
if (a instanceof Array) {
|
32
|
+
if (b.length != a.length) return false;
|
33
|
+
for (var i = 0; i < b.length; i++)
|
34
|
+
if (!this.compare(a[i], b[i])) return false;
|
35
|
+
} else if (a instanceof Object) {
|
36
|
+
for (var key in a)
|
37
|
+
if (!this.compare(a[key], b[key])) return false;
|
38
|
+
for (var key in b)
|
39
|
+
if (!this.compare(b[key], a[key])) return false;
|
40
|
+
} else {
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
return true;
|
44
|
+
},
|
45
|
+
|
46
|
+
compareArguments: function(a, b) {
|
47
|
+
return this.compare(Smoke.argumentsToArray(a), Smoke.argumentsToArray(b));
|
48
|
+
}
|
49
|
+
};
|
data/lib/smoke.mock.js
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
// Overide these functions for custom pass/fail behaviours
|
2
|
+
Smoke.passed = function(mock){
|
3
|
+
Smoke.passCount++;
|
4
|
+
};
|
5
|
+
|
6
|
+
Smoke.failed = function(mock, message){
|
7
|
+
Smoke.failCount++;
|
8
|
+
throw(message);
|
9
|
+
};
|
10
|
+
|
11
|
+
// Some helpers
|
12
|
+
Smoke.reset = function(){
|
13
|
+
Smoke.mocks = Smoke.mocks || [];
|
14
|
+
for(var i=0; i<Smoke.mocks.length; i++) Smoke.mocks[i]._resetMocks();
|
15
|
+
Smoke.mocks = [];
|
16
|
+
Smoke.passCount = 0;
|
17
|
+
Smoke.failCount = 0;
|
18
|
+
};
|
19
|
+
Smoke.reset();
|
20
|
+
|
21
|
+
Smoke.checkExpectations = function(){
|
22
|
+
for(var i=0; i<Smoke.mocks.length; i++) Smoke.mocks[i]._checkExpectations();
|
23
|
+
};
|
24
|
+
|
25
|
+
Smoke.Mock = function(originalObj) {
|
26
|
+
var obj = originalObj || {} ;
|
27
|
+
obj._expectations = {};
|
28
|
+
obj._valuesBeforeMocking = {};
|
29
|
+
|
30
|
+
obj.stub = function(attr){
|
31
|
+
return new Smoke.Stub(this, attr);
|
32
|
+
};
|
33
|
+
|
34
|
+
obj.should_receive = function(attr){
|
35
|
+
var expectation = new Smoke.Mock.Expectation(this, attr);
|
36
|
+
this._expectations[attr] = (this._expectations[attr] || []).concat([expectation]);
|
37
|
+
this._valuesBeforeMocking[attr] = this[attr];
|
38
|
+
if(this._expectations[attr].length == 1) {
|
39
|
+
this[attr] = Smoke.Mock.Expectation.stub(this, attr);
|
40
|
+
}
|
41
|
+
return expectation;
|
42
|
+
};
|
43
|
+
|
44
|
+
obj._checkExpectations = function(){
|
45
|
+
for(var e in this._expectations) {
|
46
|
+
var expectations = this._expectations[e]
|
47
|
+
for(var i=0; i < expectations.length; i++) expectations[i].check();
|
48
|
+
};
|
49
|
+
};
|
50
|
+
|
51
|
+
obj._resetMocks = function(){
|
52
|
+
for(var attr in this._valuesBeforeMocking) {
|
53
|
+
this[attr] = this._valuesBeforeMocking[attr];
|
54
|
+
}
|
55
|
+
|
56
|
+
delete this._valuesBeforeMocking;
|
57
|
+
delete this._expectations;
|
58
|
+
delete this._resetMocks;
|
59
|
+
delete this._checkExpectations;
|
60
|
+
delete this.stub;
|
61
|
+
delete this.should_receive;
|
62
|
+
};
|
63
|
+
|
64
|
+
Smoke.mocks.push(obj);
|
65
|
+
return obj;
|
66
|
+
};
|
67
|
+
|
68
|
+
Smoke.MockFunction = function(originalFunction, name) {
|
69
|
+
name = name || 'anonymous_function';
|
70
|
+
var mock = Smoke.Mock(function() {
|
71
|
+
var return_value = arguments.callee[name].apply(this, arguments);
|
72
|
+
if (return_value === undefined) {
|
73
|
+
return_value = (originalFunction || new Function()).apply(this, arguments)
|
74
|
+
}
|
75
|
+
return return_value;
|
76
|
+
});
|
77
|
+
mock[name] = (originalFunction || new Function());
|
78
|
+
mock.should_be_invoked = function() {
|
79
|
+
return this.should_receive(name);
|
80
|
+
}
|
81
|
+
return mock;
|
82
|
+
};
|
83
|
+
|
84
|
+
Smoke.Mock.Expectation = function(mock, attr) {
|
85
|
+
this._mock = mock;
|
86
|
+
this._attr = attr;
|
87
|
+
this.callCount = 0;
|
88
|
+
this.returnValue = undefined;
|
89
|
+
this.callerArgs = undefined;
|
90
|
+
this.hasReturnValue = false;
|
91
|
+
};
|
92
|
+
|
93
|
+
Smoke.Mock.Expectation.stub = function(mock, attr) {
|
94
|
+
return function() {
|
95
|
+
return function() {
|
96
|
+
var matched, return_value, args = arguments;
|
97
|
+
jQuery.each(this, function() {
|
98
|
+
this.run(args) && (matched = true) && (return_value = this.returnValue);
|
99
|
+
});
|
100
|
+
if (!matched) {
|
101
|
+
this[0].argumentMismatchError(args)
|
102
|
+
}
|
103
|
+
return return_value;
|
104
|
+
}.apply(mock._expectations[attr], arguments);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
Smoke.Mock.Expectation.prototype = {
|
110
|
+
exactly: function(count,type){
|
111
|
+
// type isn't used for now, it's just syntax ;)
|
112
|
+
this.minCount = this.maxCount = undefined;
|
113
|
+
this.exactCount = this.parseCount(count);
|
114
|
+
return this;
|
115
|
+
},
|
116
|
+
at_most: function(count,type){
|
117
|
+
this.maxCount = this.parseCount(count);
|
118
|
+
return this;
|
119
|
+
},
|
120
|
+
at_least: function(count,type){
|
121
|
+
this.minCount = this.parseCount(count);
|
122
|
+
return this;
|
123
|
+
},
|
124
|
+
with_arguments: function(){
|
125
|
+
this.callerArgs = arguments;
|
126
|
+
return this
|
127
|
+
},
|
128
|
+
run: function(args){
|
129
|
+
if((this.callerArgs === undefined) || Smoke.compareArguments(args, this.callerArgs)) {
|
130
|
+
return !!(this.callCount+=1);
|
131
|
+
};
|
132
|
+
return false
|
133
|
+
},
|
134
|
+
and_return: function(v){
|
135
|
+
this.hasReturnValue = true;
|
136
|
+
this.returnValue = v;
|
137
|
+
},
|
138
|
+
check: function(){
|
139
|
+
if(this.exactCount!=undefined) this.checkExactCount();
|
140
|
+
if(this.minCount!=undefined) this.checkMinCount();
|
141
|
+
if(this.maxCount!=undefined) this.checkMaxCount();
|
142
|
+
},
|
143
|
+
checkExactCount: function(){
|
144
|
+
if(this.exactCount==this.callCount) Smoke.passed(this)//console.log('Mock passed!')
|
145
|
+
else Smoke.failed(this, 'expected '+this.methodSignature()+' to be called exactly '+this.exactCount+" times but it got called "+this.callCount+' times');
|
146
|
+
},
|
147
|
+
checkMinCount: function(){
|
148
|
+
if(this.minCount<=this.callCount) Smoke.passed(this);
|
149
|
+
else Smoke.failed(this, 'expected '+this.methodSignature()+' to be called at least '+this.minCount+" times but it only got called "+this.callCount+' times');
|
150
|
+
},
|
151
|
+
checkMaxCount: function(){
|
152
|
+
if(this.maxCount>=this.callCount) Smoke.passed(this);//console.log('Mock passed!')
|
153
|
+
else Smoke.failed(this, 'expected '+this.methodSignature()+' to be called at most '+this.maxCount+" times but it actually got called "+this.callCount+' times');
|
154
|
+
},
|
155
|
+
argumentMismatchError: function(args) {
|
156
|
+
Smoke.failed(this, 'expected ' + this._attr + ' with ' + Smoke.printArguments(this.callerArgs) + ' but received it with ' + Smoke.printArguments(args));
|
157
|
+
},
|
158
|
+
methodSignature: function(){
|
159
|
+
return this._attr + Smoke.printArguments(this.callerArgs);
|
160
|
+
},
|
161
|
+
parseCount: function(c){
|
162
|
+
switch(c){
|
163
|
+
case 'once':
|
164
|
+
return 1;
|
165
|
+
case 'twice':
|
166
|
+
return 2;
|
167
|
+
default:
|
168
|
+
return c;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
};
|
data/lib/smoke.stub.js
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Smoke.Stub = function(obj,attr) {
|
2
|
+
this.obj = obj;
|
3
|
+
this.attribute = attr;
|
4
|
+
this.and_return(this.defaultReturn);
|
5
|
+
};
|
6
|
+
|
7
|
+
Smoke.Stub.prototype = {
|
8
|
+
defaultReturn: null,
|
9
|
+
property: function(p){
|
10
|
+
this.property = p;
|
11
|
+
this.and_set_to(this.defaultReturn);
|
12
|
+
return this
|
13
|
+
},
|
14
|
+
method: function(f){
|
15
|
+
this.func = f;
|
16
|
+
this.and_return(this.defaultReturn);
|
17
|
+
return this
|
18
|
+
},
|
19
|
+
and_return: function(v){
|
20
|
+
this.obj[this.attribute] = function() {
|
21
|
+
return v
|
22
|
+
};
|
23
|
+
return this.obj
|
24
|
+
},
|
25
|
+
and_set_to: function(v){
|
26
|
+
this.obj[this.attribute] = v;
|
27
|
+
return this.obj
|
28
|
+
}
|
29
|
+
};
|
data/lib/test_runner.js
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
if(arguments.length == 0) {
|
2
|
+
print("Usage: test_runner.js spec/javascripts/file_spec.js");
|
3
|
+
quit(1);
|
4
|
+
}
|
5
|
+
|
6
|
+
var PLUGIN_PREFIX = environment["blue.ridge.prefix"] || "../../vendor/plugins/blue-ridge";
|
7
|
+
|
8
|
+
var BlueRidge = {
|
9
|
+
require: function(file, options){
|
10
|
+
load(file);
|
11
|
+
|
12
|
+
options = options || {};
|
13
|
+
if(options['onload']) {
|
14
|
+
options['onload'].call();
|
15
|
+
}
|
16
|
+
},
|
17
|
+
|
18
|
+
css: function(url, options) {
|
19
|
+
// can do nothing in test_runner
|
20
|
+
},
|
21
|
+
|
22
|
+
debug: function(message){
|
23
|
+
print(message);
|
24
|
+
},
|
25
|
+
|
26
|
+
get fixtureFile(){
|
27
|
+
return "fixtures/" + this.specFile.replace(/^(.*?)_spec\.js$/, "$1.html");
|
28
|
+
}
|
29
|
+
};
|
30
|
+
|
31
|
+
BlueRidge.specFile = arguments[0];
|
32
|
+
|
33
|
+
var require = require || BlueRidge.require;
|
34
|
+
var css = css || BlueRidge.css;
|
35
|
+
var debug = debug || BlueRidge.debug;
|
36
|
+
|
37
|
+
// Mock up the Firebug API for convenience.
|
38
|
+
var console = console || {debug: debug};
|
39
|
+
|
40
|
+
load(PLUGIN_PREFIX + "/lib/env.rhino.js");
|
41
|
+
window.location = BlueRidge.fixtureFile;
|
42
|
+
|
43
|
+
load(PLUGIN_PREFIX + "/lib/jquery-1.3.2.js");
|
44
|
+
load(PLUGIN_PREFIX + "/lib/jquery.fn.js");
|
45
|
+
load(PLUGIN_PREFIX + "/lib/jquery.print.js");
|
46
|
+
load(PLUGIN_PREFIX + "/lib/screw.builder.js");
|
47
|
+
load(PLUGIN_PREFIX + "/lib/screw.matchers.js");
|
48
|
+
load(PLUGIN_PREFIX + "/lib/screw.events.js");
|
49
|
+
load(PLUGIN_PREFIX + "/lib/screw.behaviors.js");
|
50
|
+
load(PLUGIN_PREFIX + "/lib/smoke.core.js");
|
51
|
+
load(PLUGIN_PREFIX + "/lib/smoke.mock.js");
|
52
|
+
load(PLUGIN_PREFIX + "/lib/smoke.stub.js");
|
53
|
+
load(PLUGIN_PREFIX + "/lib/screw.mocking.js");
|
54
|
+
load(PLUGIN_PREFIX + "/lib/consoleReportForRake.js");
|
55
|
+
|
56
|
+
print("Running " + BlueRidge.specFile + " with fixture '" + BlueRidge.fixtureFile + "'...");
|
57
|
+
load(BlueRidge.specFile);
|
58
|
+
jQuery(window).trigger("load");
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class AccountsController < ApplicationController
|
2
|
+
# GET /accounts
|
3
|
+
# GET /accounts.xml
|
4
|
+
def index
|
5
|
+
@accounts = Account.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @accounts }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /accounts/1
|
14
|
+
# GET /accounts/1.xml
|
15
|
+
def show
|
16
|
+
@account = Account.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @account }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /accounts/new
|
25
|
+
# GET /accounts/new.xml
|
26
|
+
def new
|
27
|
+
@account = Account.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @account }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /accounts/1/edit
|
36
|
+
def edit
|
37
|
+
@account = Account.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /accounts
|
41
|
+
# POST /accounts.xml
|
42
|
+
def create
|
43
|
+
@account = Account.new(params[:account])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @account.save
|
47
|
+
flash[:notice] = 'Account was successfully created.'
|
48
|
+
format.html { redirect_to(@account) }
|
49
|
+
format.xml { render :xml => @account, :status => :created, :location => @account }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @account.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /accounts/1
|
58
|
+
# PUT /accounts/1.xml
|
59
|
+
def update
|
60
|
+
@account = Account.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @account.update_attributes(params[:account])
|
64
|
+
flash[:notice] = 'Account was successfully updated.'
|
65
|
+
format.html { redirect_to(@account) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @account.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /accounts/1
|
75
|
+
# DELETE /accounts/1.xml
|
76
|
+
def destroy
|
77
|
+
@account = Account.find(params[:id])
|
78
|
+
@account.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(accounts_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|