diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..67e4680 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper \ No newline at end of file diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..3e524d4 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +middleman-webpack diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..0bee604 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.3.3 diff --git a/Gemfile b/Gemfile index 4ac721d..593f168 100644 --- a/Gemfile +++ b/Gemfile @@ -10,4 +10,12 @@ gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby] # Middleman Gems gem 'middleman', '~> 4.2' -gem 'middleman-livereload', '~> 3.4' + +group :development do + gem 'middleman-livereload', '~> 3.4' +end +group :test do + gem 'rake', '~> 10.4' + gem 'rspec', '~> 3.4' + gem 'capybara', '~> 2.5' +end \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index b444fbb..5e7cfd9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,13 @@ GEM addressable (2.5.0) public_suffix (~> 2.0, >= 2.0.2) backports (3.6.8) + capybara (2.13.0) + addressable + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) coffee-script (2.4.1) coffee-script-source execjs @@ -17,6 +24,7 @@ GEM sass (>= 3.2, < 3.5) concurrent-ruby (1.0.5) contracts (0.13.0) + diff-lcs (1.3) dotenv (2.2.0) em-websocket (0.5.1) eventmachine (>= 0.12.9) @@ -76,7 +84,13 @@ GEM em-websocket (~> 0.5.1) middleman-core (>= 3.3) rack-livereload (~> 0.3.15) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_portile2 (2.1.0) minitest (5.10.1) + nokogiri (1.7.1) + mini_portile2 (~> 2.1.0) padrino-helpers (0.13.3.3) i18n (~> 0.6, >= 0.6.7) padrino-support (= 0.13.3.3) @@ -88,9 +102,25 @@ GEM rack (2.0.1) rack-livereload (0.3.16) rack + rack-test (0.6.3) + rack (>= 1.0) + rake (10.5.0) rb-fsevent (0.9.8) rb-inotify (0.9.8) ffi (>= 0.5.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) sass (3.4.23) servolux (0.13.0) thor (0.19.4) @@ -100,13 +130,18 @@ GEM thread_safe (~> 0.1) uglifier (3.1.10) execjs (>= 0.3.0, < 3) + xpath (2.0.0) + nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES + capybara (~> 2.5) middleman (~> 4.2) middleman-livereload (~> 3.4) + rake (~> 10.4) + rspec (~> 3.4) tzinfo-data wdm (~> 0.1.0) diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..9e961e3 --- /dev/null +++ b/Rakefile @@ -0,0 +1,5 @@ +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task :default => :spec \ No newline at end of file diff --git a/environments/console.rb b/environments/console.rb new file mode 100644 index 0000000..e69de29 diff --git a/environments/development.rb b/environments/development.rb index de0f875..ac7ff1d 100644 --- a/environments/development.rb +++ b/environments/development.rb @@ -1,3 +1,5 @@ +Bundler.require(:default, :development) + configure :development do activate :livereload, no_swf: true end diff --git a/spec/features/index_spec.rb b/spec/features/index_spec.rb new file mode 100644 index 0000000..c889d36 --- /dev/null +++ b/spec/features/index_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe 'index', :type => :feature do + before do + visit '/' + end + + it 'has the correct title header' do + expect(page).to have_selector 'h1' + within 'h1' do + expect(page).to have_content "Middleman is Running" + end + end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..9ae0195 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,13 @@ +require 'bundler' +Bundler.require(:default, :test) + +require "rspec" +require "capybara/rspec" + +middleman_app = ::Middleman::Application.new do + set :root, File.expand_path(File.join(File.dirname(__FILE__), "..")) + set :environment, :test + set :show_exceptions, true +end + +Capybara.app = ::Middleman::Rack.new(middleman_app).to_app \ No newline at end of file