Skip to content

Commit

Permalink
added possibility to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Adler committed Mar 29, 2017
1 parent a89e074 commit 031370d
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--require spec_helper
1 change: 1 addition & 0 deletions .ruby-gemset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
middleman-webpack
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.3
10 changes: 9 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 35 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
Empty file added environments/console.rb
Empty file.
2 changes: 2 additions & 0 deletions environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Bundler.require(:default, :development)

configure :development do
activate :livereload, no_swf: true
end
Expand Down
14 changes: 14 additions & 0 deletions spec/features/index_spec.rb
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 031370d

Please sign in to comment.