Skip to content

Commit 38d951e

Browse files
author
Sam Phippen
committed
Add cukes
1 parent 1f9d46e commit 38d951e

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

Rakefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ end
2828

2929
Cucumber::Rake::Task.new(:cucumber) do |t|
3030
version = ENV.fetch("RAILS_VERSION", "~> 4.2.0")
31-
cucumber_flag = "--tags ~@rails_post_5"
3231
tags = []
32+
3333
if version.to_f >= 5.1
3434
tags << "~@rails_pre_5.1"
3535
end
@@ -38,8 +38,13 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
3838
tags << "~@rails_pre_5"
3939
end
4040

41+
if version.to_f == 5.0
42+
tags << "~@system_test"
43+
end
44+
4145
if tags.empty?
4246
tags << "~@rails_post_5"
47+
tags << "~@system_test"
4348
end
4449

4550
cucumber_flag = tags.map { |tag| "--tag #{tag}" }

example_app_generator/generate_app.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
gsub_file 'Gemfile', /^.*\bgem 'rails.*$/, ''
2121
gsub_file "Gemfile", /.*web-console.*/, ''
2222
gsub_file "Gemfile", /.*debugger.*/, ''
23+
gsub_file "Gemfile", /.*puma.*/, ""
2324

2425
if Rails::VERSION::STRING >= '5.0.0'
2526
append_to_file('Gemfile', "gem 'rails-controller-testing', :git => 'https://github.com/rails/rails-controller-testing'\n")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Feature: System spec
2+
3+
System specs are RSpec's wrapper around Rails' own
4+
[system tests](http://guides.rubyonrails.org/testing.html#system-testing).
5+
We encourage you to familiarse yourself with their documentation.
6+
7+
RSpec **does not** use your `ApplicationSystemTestCase` helper. Instead it uses
8+
the default `driven_by(:selenium)` from Rails. If you want to override this
9+
behaviour you can call `driven_by` manually in a test.
10+
11+
12+
@system_test
13+
Scenario: System specs
14+
Given a file named "spec/system/widget_system_spec.rb" with:
15+
"""ruby
16+
require "rails_helper"
17+
18+
RSpec.describe "Widget management", :type => :system do
19+
before do
20+
driven_by(:rack_test)
21+
end
22+
23+
it "enables me to create widgets" do
24+
visit "/widgets/new"
25+
26+
fill_in "Name", :with => "My Widget"
27+
click_button "Create Widget"
28+
29+
expect(page).to have_text("Widget was successfully created.")
30+
end
31+
end
32+
"""
33+
When I run `rspec spec/system/widget_system_spec.rb`
34+
Then the exit status should be 0
35+
And the output should contain "1 example, 0 failures"

0 commit comments

Comments
 (0)