Skip to content

Commit

Permalink
Add cukes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Phippen committed Jun 16, 2017
1 parent 57a4bbc commit 3bc329d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ end

Cucumber::Rake::Task.new(:cucumber) do |t|
version = ENV.fetch("RAILS_VERSION", "~> 4.2.0")
cucumber_flag = "--tags ~@rails_post_5"
tags = []

if version.to_f >= 5.1
tags << "~@rails_pre_5.1"
end
Expand All @@ -38,8 +38,13 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
tags << "~@rails_pre_5"
end

if version.to_f == 5.0
tags << "~@system_test"
end

if tags.empty?
tags << "~@rails_post_5"
tags << "~@system_test"
end

cucumber_flag = tags.map { |tag| "--tag #{tag}" }
Expand Down
1 change: 1 addition & 0 deletions example_app_generator/generate_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
gsub_file 'Gemfile', /^.*\bgem 'rails.*$/, ''
gsub_file "Gemfile", /.*web-console.*/, ''
gsub_file "Gemfile", /.*debugger.*/, ''
gsub_file "Gemfile", /.*puma.*/, ""

if Rails::VERSION::STRING >= '5.0.0'
append_to_file('Gemfile', "gem 'rails-controller-testing', :git => 'https://github.com/rails/rails-controller-testing'\n")
Expand Down
35 changes: 35 additions & 0 deletions features/system_specs/system_specs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Feature: System spec

System specs are RSpec's wrapper around Rails' own
[system tests](http://guides.rubyonrails.org/testing.html#system-testing).
We encourage you to familiarse yourself with their documentation.

RSpec **does not** use your `ApplicationSystemTestCase` helper. Instead it uses
the default `driven_by(:selenium)` from Rails. If you want to override this
behaviour you can call `driven_by` manually in a test.


@system_test
Scenario: System specs
Given a file named "spec/system/widget_system_spec.rb" with:
"""ruby
require "rails_helper"
RSpec.describe "Widget management", :type => :system do
before do
driven_by(:rack_test)
end
it "enables me to create widgets" do
visit "/widgets/new"
fill_in "Name", :with => "My Widget"
click_button "Create Widget"
expect(page).to have_text("Widget was successfully created.")
end
end
"""
When I run `rspec spec/system/widget_system_spec.rb`
Then the exit status should be 0
And the output should contain "1 example, 0 failures"

0 comments on commit 3bc329d

Please sign in to comment.