forked from foundation/foundation-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Because: We encountered lately too much 💥 that could be avoided. This commit: Is a starting point for testing the gem. The first thing tested here is the generator, ensuring it creates or updates the expected files.
- Loading branch information
Mehdi Lahmam
committed
May 3, 2015
1 parent
7567068
commit 1c9164b
Showing
64 changed files
with
82 additions
and
3,766 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
require "bundler/gem_tasks" | ||
require 'bundler/setup' | ||
require 'bundler/gem_tasks' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:rspec) | ||
|
||
desc 'Run the test suite' | ||
task :default => :rspec |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'spec_helper' | ||
|
||
feature 'Foundation install succeeds' do | ||
scenario 'stylesheets assets files are added' do | ||
application_css_file = IO.read("#{dummy_app_path}/app/assets/stylesheets/application.css") | ||
|
||
expect(File).to exist("#{dummy_app_path}/app/assets/stylesheets/foundation_and_overrides.scss") | ||
expect(application_css_file).to match(/require foundation_and_overrides/) | ||
end | ||
|
||
scenario 'javascripts assets files are added' do | ||
application_js_file = IO.read("#{dummy_app_path}/app/assets/javascripts/application.js") | ||
|
||
expect(application_js_file).to match(/require foundation/) | ||
expect(application_js_file).to match(Regexp.new(Regexp.escape('$(function(){ $(document).foundation(); });'))) | ||
end | ||
|
||
scenario 'layout file loads assets' do | ||
layout_file = IO.read("#{dummy_app_path}/app/views/layouts/application.html.erb") | ||
|
||
expect(layout_file).to match(/stylesheet_link_tag "application"/) | ||
expect(layout_file).to match(/javascript_include_tag "vendor\/modernizr"/) | ||
expect(layout_file).to match(/javascript_include_tag "application/) | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'capybara/rspec' | ||
require 'bundler/setup' | ||
|
||
Bundler.require(:default, :test) | ||
|
||
Dir['./spec/support/**/*.rb'].each { |file| require file } | ||
|
||
RSpec.configure do |config| | ||
config.include FoundationRailsTestHelpers | ||
|
||
config.before(:all) do | ||
create_dummy_app | ||
install_foundation | ||
end | ||
|
||
config.after(:all) do | ||
remove_dummy_app | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module FoundationRailsTestHelpers | ||
def create_dummy_app | ||
FileUtils.cd(tmp_path) do | ||
%x(rails new dummy --skip-active-record --skip-test-unit --skip-spring) | ||
end | ||
end | ||
|
||
def remove_dummy_app | ||
FileUtils.rm_rf(dummy_app_path) | ||
end | ||
|
||
def install_foundation | ||
FileUtils.cd(dummy_app_path) do | ||
%x(rails g foundation:install -f 2>&1) | ||
end | ||
end | ||
|
||
def dummy_app_path | ||
File.join(tmp_path, 'dummy') | ||
end | ||
|
||
def tmp_path | ||
@tmp_path ||= File.join(File.dirname(__FILE__), '..') | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.