Created
November 1, 2011 02:35
-
-
Save dyba/1329679 to your computer and use it in GitHub Desktop.
Jasmine YML file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! 5 | |
%html | |
%head | |
%title TESTAPP | |
= stylesheet_link_tag "application" | |
= javascript_include_tag "application", "registration" | |
= csrf_meta_tag | |
%body | |
%header | |
%h1#logo | |
Logo goes here | |
%div#session | |
- if current_user | |
Welcome, | |
= current_user.username | |
| | |
= link_to "My Account" | |
| | |
= link_to "Log out", log_out_path | |
- else | |
= link_to "Log in", log_in_path | |
| | |
= link_to "Register", register_path | |
%div.float-divider | |
= yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: Expected '<div id="address_fields">Address Fields</div>' to be hidden. | |
at new <anonymous> (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:102:32) | |
at [object Object].toBeHidden (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1171:29) | |
at [object Object].<anonymous> (http://localhost:8888/__spec__/registration_spec.js:8:36) | |
at [object Object].execute (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1001:15) | |
at [object Object].next_ (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1790:31) | |
at http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1780:18 | |
Error: Expected '<div id="phone_number_fields">Phone Number Fields</div>' to be hidden. | |
at new <anonymous> (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:102:32) | |
at [object Object].toBeHidden (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1171:29) | |
at [object Object].<anonymous> (http://localhost:8888/__spec__/registration_spec.js:12:41) | |
at [object Object].execute (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1001:15) | |
at [object Object].next_ (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1790:31) | |
at [object Object].start (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1743:8) | |
at [object Object].execute (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2070:14) | |
at [object Object].next_ (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1790:31) | |
at http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1786:18 | |
at [object Object].finish (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2044:5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# src_files | |
# | |
# Return an array of filepaths relative to src_dir to include before jasmine specs. | |
# Default: [] | |
# | |
# EXAMPLE: | |
# | |
# src_files: | |
# - lib/source1.js | |
# - lib/source2.js | |
# - dist/**/*.js | |
# | |
src_files: | |
- app/assets/javascripts/application.js | |
- app/assets/javascripts/registration.js | |
# stylesheets | |
# | |
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs. | |
# Default: [] | |
# | |
# EXAMPLE: | |
# | |
# stylesheets: | |
# - css/style.css | |
# - stylesheets/*.css | |
# | |
stylesheets: | |
- app/assets/stylesheets/register.css | |
# helpers | |
# | |
# Return an array of filepaths relative to spec_dir to include before jasmine specs. | |
# Default: ["helpers/**/*.js"] | |
# | |
# EXAMPLE: | |
# | |
# helpers: | |
# - helpers/**/*.js | |
# | |
helpers: | |
- helpers/jquery-1.6.4.js | |
- helpers/jasmine_jquery-1.3.1.js | |
# spec_files | |
# | |
# Return an array of filepaths relative to spec_dir to include. | |
# Default: ["**/*[sS]pec.js"] | |
# | |
# EXAMPLE: | |
# | |
# spec_files: | |
# - **/*[sS]pec.js | |
# | |
spec_files: | |
- registration_spec.js | |
# src_dir | |
# | |
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank. | |
# Default: project root | |
# | |
# EXAMPLE: | |
# | |
# src_dir: public | |
# | |
src_dir: | |
# spec_dir | |
# | |
# Spec directory path. Your spec_files must be returned relative to this path. | |
# Default: spec/javascripts | |
# | |
# EXAMPLE: | |
# | |
# spec_dir: spec/javascripts | |
# | |
spec_dir: spec/javascripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/> | |
<title>Jasmine suite</title> | |
<link rel="shortcut icon" type="image/png" href="/__JASMINE_ROOT__/images/jasmine_favicon.png"> | |
<link rel="stylesheet" href="/__JASMINE_ROOT__/jasmine.css" type="text/css" media="screen"/> | |
<link rel="stylesheet" href="/app/assets/stylesheets/register.css" type="text/css" media="screen"/> | |
<script src="/__JASMINE_ROOT__/jasmine.js" type="text/javascript"></script> | |
<script src="/__JASMINE_ROOT__/jasmine-html.js" type="text/javascript"></script> | |
<script src="/__JASMINE_ROOT__/json2.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
var jsApiReporter; | |
(function() { | |
var jasmineEnv = jasmine.getEnv(); | |
jsApiReporter = new jasmine.JsApiReporter(); | |
var trivialReporter = new jasmine.TrivialReporter(); | |
jasmineEnv.addReporter(jsApiReporter); | |
jasmineEnv.addReporter(trivialReporter); | |
jasmineEnv.specFilter = function(spec) { | |
return trivialReporter.specFilter(spec); | |
}; | |
var currentWindowOnload = window.onload; | |
window.onload = function() { | |
if (currentWindowOnload) { | |
currentWindowOnload(); | |
} | |
execJasmine(); | |
}; | |
function execJasmine() { | |
jasmineEnv.execute(); | |
} | |
})(); | |
</script> | |
<script src="/app/assets/javascripts/application.js" type="text/javascript"></script> | |
<script src="/app/assets/javascripts/registration.js" type="text/javascript"></script> | |
<script src="/__spec__/helpers/jquery-1.6.4.js" type="text/javascript"></script> | |
<script src="/__spec__/helpers/jasmine_jquery-1.3.1.js" type="text/javascript"></script> | |
<script src="/__spec__/registration_spec.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="jasmine_content"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/> | |
<title>Jasmine suite</title> | |
<link rel="shortcut icon" type="image/png" href="/__JASMINE_ROOT__/images/jasmine_favicon.png"> | |
<link rel="stylesheet" href="/__JASMINE_ROOT__/jasmine.css" type="text/css" media="screen"/> | |
<link rel="stylesheet" href="/app/assets/stylesheets/register.css" type="text/css" media="screen"/> | |
<script src="/__JASMINE_ROOT__/jasmine.js" type="text/javascript"></script> | |
<script src="/__JASMINE_ROOT__/jasmine-html.js" type="text/javascript"></script> | |
<script src="/__JASMINE_ROOT__/json2.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
var jsApiReporter; | |
(function() { | |
var jasmineEnv = jasmine.getEnv(); | |
jsApiReporter = new jasmine.JsApiReporter(); | |
var trivialReporter = new jasmine.TrivialReporter(); | |
jasmineEnv.addReporter(jsApiReporter); | |
jasmineEnv.addReporter(trivialReporter); | |
jasmineEnv.specFilter = function(spec) { | |
return trivialReporter.specFilter(spec); | |
}; | |
var currentWindowOnload = window.onload; | |
window.onload = function() { | |
if (currentWindowOnload) { | |
currentWindowOnload(); | |
} | |
execJasmine(); | |
}; | |
function execJasmine() { | |
jasmineEnv.execute(); | |
} | |
})(); | |
</script> | |
<script src="/spec/javascripts/helpers/jquery-1.6.4.js" type="text/javascript"></script> | |
<script src="/spec/javascripts/helpers/jasmine_jquery-1.3.1.js" type="text/javascript"></script> | |
<script src="/public/javascripts/application.js" type="text/javascript"></script> | |
<script src="/app/assets/javascripts/registration.js" type="text/javascript"></script> | |
<script src="/spec/javascripts/registration_spec.js" type="text/javascript"></script> | |
<script src="/__spec__/" type="text/javascript"></script> | |
<script src="/__spec__/" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="jasmine_content"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- in spec/javascripts/fixtures/ --> | |
<form> | |
<input name="user[is_leasing]" type="hidden" value="0" /><input id="user_is_leasing" name="user[is_leasing]" type="checkbox" value="1" /> | |
<div id='address_fields'>Address Fields</div> | |
<div id='phone_number_fields'>Phone Number Fields</div> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in app/assets/javascripts/ | |
$(function() { | |
$("#address_fields").hide(); | |
$("#phone_number_fields").hide(); | |
$("#user_is_leasing").click(function() { | |
if ( $(this).is(':checked') ) { | |
$("#address_fields").show(); | |
$("#phone_number_fields").show(); | |
} else { | |
$("#address_fields").hide(); | |
$("#phone_number_fields").hide(); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in spec/javascripts/registration_spec.js | |
describe("Register Page", function() { | |
describe("On Page Load", function() { | |
beforeEach(function() { | |
loadFixtures("register_fixture.html"); | |
//$("#address_fields").toggleShowHide(); | |
//$("#phone_number_fields").toggleShowHide(); | |
}); | |
it("hides the address fields", function() { | |
expect($("#address_fields")).toBeHidden(); | |
}); | |
it("hides the phone number fields", function() { | |
expect($("#phone_number_fields")).toBeHidden(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment