Skip to content

Commit f592131

Browse files
javascripts test with blue-ridge
1 parent 17114bd commit f592131

File tree

15 files changed

+391
-2
lines changed

15 files changed

+391
-2
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vendor/plugins/blue-ridge"]
2+
path = vendor/plugins/blue-ridge
3+
url = git://github.com/dcrec1/blue-ridge.git

app/views/forum/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<%= form_for @question do |f| -%>
2-
<p><%= f.text_field :name %></p>
2+
<p><%= f.label :name %><%= f.text_field :name %></p>
33
<p><%= f.text_field :email %></p>
44
<p><%= f.text_field :title %></p>
55
<p><%= f.text_area :text %></p>

app/views/layouts/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<title>AppDemo</title>
55
<%= stylesheet_link_tag :all %>
6-
<%= javascript_include_tag :defaults %>
6+
<%= javascript_include_tag "jquery","jquery.validate","forum" %>
77
<%= csrf_meta_tag %>
88
</head>
99
<body>

public/javascripts/forum.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$(document).ready(function(){
2+
$("#new_question").validate({
3+
debug: true,
4+
rules: {
5+
"question[name]": "required",
6+
"question[title]": "required"
7+
},
8+
messages: {
9+
"question[name]": "Nome nao pode estar em branco",
10+
"question[title]": "titulo nao pode estar em branco",
11+
}
12+
});
13+
});

public/javascripts/jquery.js

Lines changed: 166 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/javascripts/jquery.validate.js

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/javascripts/application_spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require("spec_helper.js");
2+
require("../../public/javascripts/application.js");
3+
$(document).ready(function(){
4+
Screw.Unit(function(){
5+
describe("Your application javascript", function(){
6+
it("does something", function(){
7+
expect("hello").to(equal, "hello");
8+
});
9+
10+
it("accesses the DOM from fixtures/application.html", function(){
11+
expect($('.select_me').length).to(equal, 2);
12+
});
13+
});
14+
});
15+
});

spec/javascripts/core_spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require("spec_helper.js");
2+
require("../../public/javascripts/core.js");
3+
4+
Screw.Unit(function(){
5+
describe("Core", function(){
6+
it("does something", function(){
7+
expect("hello").to(equal, "hello");
8+
});
9+
});
10+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
4+
<head>
5+
<title>Application | JavaScript Testing Results</title>
6+
<link rel="stylesheet" href="screw.css" type="text/css" charset="utf-8" />
7+
<script type="text/javascript" src="../../../vendor/plugins/blue-ridge/lib/blue-ridge.js"></script>
8+
</head>
9+
10+
<body>
11+
<!-- Put any HTML fixture elements here. -->
12+
<div class="select_me"/>
13+
<span class="select_me"/>
14+
<div class="dont_select_me"/>
15+
</body>
16+
</html>

spec/javascripts/fixtures/core.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
4+
<head>
5+
<title>Core | JavaScript Testing Results</title>
6+
<link rel="stylesheet" href="screw.css" type="text/css" charset="utf-8" />
7+
<script type="text/javascript" src="../../../vendor/plugins/blue-ridge/lib/blue-ridge.js"></script>
8+
</head>
9+
10+
<body>
11+
<!-- Put any HTML fixture elements here. -->
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)