Skip to content

Commit

Permalink
Fix broken specs
Browse files Browse the repository at this point in the history
  • Loading branch information
00dav00 committed Jun 5, 2019
1 parent 5eef207 commit 65ea1e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/generators/rspec/controller/controller_generator.rb
Expand Up @@ -12,7 +12,6 @@ class ControllerGenerator < Base
class_option :routing_specs, :type => :boolean, :default => false, :desc => "Generate routing specs"

def generate_controller_spec
return if actions.empty?
return unless options[:controller_specs]

template 'controller_spec.rb',
Expand All @@ -33,6 +32,7 @@ def generate_view_specs
end

def generate_routing_spec
return if actions.empty?
return unless options[:routing_specs]

template 'routing_spec.rb',
Expand Down
22 changes: 11 additions & 11 deletions spec/generators/rspec/controller/controller_generator_spec.rb
Expand Up @@ -15,7 +15,7 @@
describe 'the spec' do
it { is_expected.to exist }
it { is_expected.to contain(/require 'rails_helper'/) }
it { is_expected.to contain(/^RSpec.describe 'PostsController', #{type_metatag(:controller)}/) }
it { is_expected.to contain(/^RSpec.describe PostsController, #{type_metatag(:controller)}/) }
end
end
describe 'skipped with a flag' do
Expand Down Expand Up @@ -95,18 +95,18 @@
subject { file('spec/routing/posts_routing_spec.rb') }

describe 'with no flag' do
before { run_generator %w(posts seek and destroy) }

before do
run_generator %w(posts seek and destroy)
end
it { is_expected.not_to exist }
end

describe 'with --routing-specs flag' do
describe 'without action parameter' do
before { run_generator %w(posts --routing-specs) }

it { is_expected.to contain(/require 'rails_helper'/) }
it { is_expected.to contain(/^RSpec.describe 'PostsController', #{type_metatag(:routing)}/) }
it { is_expected.to contain(/describe 'routing'/) }
before do
run_generator %w(posts --routing-specs)
end
it { is_expected.not_to exist }
end

describe 'with action parameter' do
Expand All @@ -115,15 +115,15 @@
it { is_expected.to contain(/require 'rails_helper'/) }
it { is_expected.to contain(/^RSpec.describe 'PostsController', #{type_metatag(:routing)}/) }
it { is_expected.to contain(/describe 'routing'/) }
``
it { is_expected.to contain(/it 'routes to #seek'/) }
it { is_expected.to contain(/expect\(:get => "\/posts\/seek"\).to route_to\("posts#seek"\)/) }
end
end

describe 'with --no-routing-specs flag' do
before { run_generator %w(posts seek and destroy --no-routing_specs) }

before do
run_generator %w(posts seek and destroy --no-routing_specs)
end
it { is_expected.not_to exist }
end
end
Expand Down

0 comments on commit 65ea1e4

Please sign in to comment.