Permalink
Browse files

Adding some basic asset tests

  • Loading branch information...
petebrowne committed Aug 23, 2011
1 parent e39eae2 commit 0dac1bbc97f1cdada52830fe204c6f63bb27c971
@@ -1,5 +1,7 @@
+require "rails/engine"
+require "jquery-rails"
+
module MediaelementRails
class Engine < Rails::Engine
- isolate_namespace MediaelementRails
end
end
@@ -1,9 +0,0 @@
-// This is a manifest file that'll be compiled into including all the files listed below.
-// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
-// be included in the compiled file accessible from http://example.com/assets/application.js
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// the compiled file.
-//
-//= require jquery
-//= require mediaelement_rails
-//= require_tree .
@@ -0,0 +1 @@
+//= require mediaelement_rails
@@ -0,0 +1 @@
+//= require mediaelement_rails/rails
@@ -1,9 +0,0 @@
-/*
- * This is a manifest file that'll automatically include all the stylesheets available in this directory
- * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
- * the top of the compiled file, but it's generally better to create a new file per style scope.
- *
- *= require mediaelement_rails
- *= require_self
- *= require_tree .
-*/
@@ -0,0 +1,3 @@
+/*
+ *= require mediaelement_rails/mejs-skins
+*/
@@ -0,0 +1,3 @@
+/*
+ *= require mediaelement_rails
+*/
@@ -5,9 +5,7 @@
require 'rails/test_unit/railtie'
require 'sprockets/railtie'
-Bundler.require
-require "jquery-rails"
-require "mediaelement_rails"
+Bundler.require :default, :development
module Dummy
class Application < Rails::Application
@@ -0,0 +1,33 @@
+require "test_helper"
+require "capybara/rails"
+
+class AssetsTest < ActionDispatch::IntegrationTest
+ include Capybara::DSL
+
+ test "MediaElement javascript" do
+ visit "/assets/mediaelement-and-player.js"
+ assert page.has_content?("jQuery JavaScript Library v1.6.2")
+ assert page.has_content?("var mejs = mejs || {}")
+ assert page.has_content?("mejs.MediaElementPlayer.prototype = {")
+ end
+
+ test "MediaElement without player javascript" do
+ visit "/assets/mediaelement-without-player.js"
+ assert page.has_no_content?("jQuery JavaScript Library v1.6.2")
+ assert page.has_content?("var mejs = mejs || {}")
+ assert page.has_no_content?("mejs.MediaElementPlayer.prototype = {")
+ end
+
+ test "MediaElement player stylesheet" do
+ visit "/assets/player.css"
+ assert page.has_content?(".mejs-container {")
+ assert page.has_content?(".mejs-mediaelement {")
+ end
+
+ test "MediaElement player skins stylesheet" do
+ visit "/assets/player-skins.css"
+ assert page.has_content?(".mejs-container.mejs-ted {")
+ assert page.has_content?(".mejs-container.mejs-wmp {")
+ end
+end
+
@@ -1,10 +0,0 @@
-require 'test_helper'
-
-class NavigationTest < ActionDispatch::IntegrationTest
- fixtures :all
-
- # test "the truth" do
- # assert true
- # end
-end
-
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class MediaelementRailsTest < ActiveSupport::TestCase
- test "truth" do
- assert_kind_of Module, MediaelementRails
- end
-end

0 comments on commit 0dac1bb

Please sign in to comment.