Skip to content

Commit

Permalink
Summary: attempted to get jasmine unit tests running, failed, dismally
Browse files Browse the repository at this point in the history
modified:   Gemfile
modified:   Gemfile.lock
	-- added a combined test / dev group

modified:   app/assets/javascripts/app.js
	-- removed textual dependencies for angular di framework

new file:   app/assets/javascripts/jasmine_examples/Player.js
new file:   app/assets/javascripts/jasmine_examples/Song.js
new file:   public/javascripts/Player.js
new file:   public/javascripts/Song.js
	-- files added from tutorial, should be deleted

modified:   app/assets/javascripts/application.js
new file:   app/assets/javascripts/directives.js
modified:   app/assets/templates/home.html
modified:   app/views/home/index.html.erb
modified:   app/views/layouts/application.html.erb

modified:   config/routes.rb
	-- attempted to add a route that would permenently redirect to angular for text/html requests. route not actually needed

deleted:    spec/javascripts/angular/controllersSpec.js
new file:   spec/javascripts/angular/e2e/runner.html
new file:   spec/javascripts/angular/e2e/scenarios.js
new file:   spec/javascripts/angular/lib/angular-mocks.js
new file:   spec/javascripts/angular/lib/angular-scenario.js
new file:   spec/javascripts/angular/lib/version.txt
new file:   spec/javascripts/angular/unit/controllersSpec.js
new file:   spec/javascripts/angular/unit/directivesSpec.js
new file:   spec/javascripts/angular/unit/filtersSpec.js
new file:   spec/javascripts/angular/unit/servicesSpec.js
new file:   spec/javascripts/helpers/.gitkeep
new file:   spec/javascripts/helpers/SpecHelper.js
new file:   spec/javascripts/jasmine_examples/PlayerSpec.js
new file:   spec/javascripts/support/jasmine.yml
	-- jasmine stuff

new file:   vendor/assets/javascripts/angular-resource.js
new file:   vendor/assets/javascripts/angular-ui-ieshiv.js
new file:   vendor/assets/javascripts/angular-ui.css
new file:   vendor/assets/javascripts/angular-ui.js
new file:   vendor/assets/javascripts/angular.js
	-- correctly added angular to asset pipeline, and added angular-ui library
  • Loading branch information
atruskie committed Nov 6, 2012
1 parent dd1c245 commit c895285
Show file tree
Hide file tree
Showing 15 changed files with 16,362 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/* App Module */

angular.module('baw', ['$routeProvider','$locationProvider'], function($routeProvider, $locationProvider ) {
angular.module('baw', [], function($routeProvider, $locationProvider ) {

// routes
$routeProvider.
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require angular.js
//= require angular-resource.js
//= require angular-ui.js
//= require angular-ui-ieshiv.js
//= require jquery
//= require jquery_ujs
//= require_tree .
Expand Down
14 changes: 14 additions & 0 deletions app/assets/javascripts/directives.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var bawApp = angular.module('baw', function() {
return function(scope, element, attrs) {
element.css('display', 'none');
scope.$watch(attrs.ngDsFade, function(value) {
if (value) {
element.fadeIn(200);
}
else {
element.fadeOut(100);
}
});
}

});
22 changes: 22 additions & 0 deletions app/assets/javascripts/jasmine_examples/Player.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function Player() {
}
Player.prototype.play = function(song) {
this.currentlyPlayingSong = song;
this.isPlaying = true;
};

Player.prototype.pause = function() {
this.isPlaying = false;
};

Player.prototype.resume = function() {
if (this.isPlaying) {
throw new Error("song is already playing");
}

this.isPlaying = true;
};

Player.prototype.makeFavorite = function() {
this.currentlyPlayingSong.persistFavoriteStatus(true);
};
7 changes: 7 additions & 0 deletions app/assets/javascripts/jasmine_examples/Song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function Song() {
}

Song.prototype.persistFavoriteStatus = function(value) {
// something complicated
throw new Error("not yet implemented");
};
2 changes: 1 addition & 1 deletion app/assets/templates/home.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>This is a test</h1>

<p>{{welcomeMessage}}</p>
<p id="wmg">{{welcomeMessage}}</p>

<a href="#/projects/" >fun times</a>
<a href="#/site/" >funny times</a>
7 changes: 0 additions & 7 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
<h1>Home#index</h1>
<p>Find me in app/views/home/index.html.erb</p>


<%= link_to "Photos", photos_path %>
<%= link_to "Projects", projects_path %>
<%= link_to "Sites", sites_path %>
3 changes: 1 addition & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<html ng-app="baw">
<head>
<title>QubarSite</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js" ></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular-resource.min.js"></script>

<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
Expand Down
22 changes: 22 additions & 0 deletions public/javascripts/Player.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function Player() {
}
Player.prototype.play = function(song) {
this.currentlyPlayingSong = song;
this.isPlaying = true;
};

Player.prototype.pause = function() {
this.isPlaying = false;
};

Player.prototype.resume = function() {
if (this.isPlaying) {
throw new Error("song is already playing");
}

this.isPlaying = true;
};

Player.prototype.makeFavorite = function() {
this.currentlyPlayingSong.persistFavoriteStatus(true);
};
7 changes: 7 additions & 0 deletions public/javascripts/Song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function Song() {
}

Song.prototype.persistFavoriteStatus = function(value) {
// something complicated
throw new Error("not yet implemented");
};
Loading

0 comments on commit c895285

Please sign in to comment.