spec/generators/rspec/scaffold/scaffold_generator_spec.rb in rspec-rails-3.0.0.beta1 vs spec/generators/rspec/scaffold/scaffold_generator_spec.rb in rspec-rails-3.0.0.beta2

- old
+ new

@@ -10,129 +10,129 @@ describe 'standard controller spec' do subject { file('spec/controllers/posts_controller_spec.rb') } describe 'with no options' do before { run_generator %w(posts) } - it { should contain(/require 'spec_helper'/) } - it { should contain(/describe PostsController/) } - it { should contain(%({ "these" => "params" })) } + it { is_expected.to contain(/require 'spec_helper'/) } + it { is_expected.to contain(/describe PostsController/) } + it { is_expected.to contain(%({ "these" => "params" })) } end describe 'with --no-controller_specs' do before { run_generator %w(posts --no-controller_specs) } - it { should_not exist } + it { is_expected.not_to exist } end end describe 'controller spec with attributes specified' do subject { file('spec/controllers/posts_controller_spec.rb') } before { run_generator %w(posts title:string) } - it { should contain(%({ "title" => "MyString" })) } + it { is_expected.to contain(%({ "title" => "MyString" })) } end describe 'namespaced controller spec' do subject { file('spec/controllers/admin/posts_controller_spec.rb') } before { run_generator %w(admin/posts) } - it { should contain(/describe Admin::PostsController/)} + it { is_expected.to contain(/describe Admin::PostsController/)} end describe 'view specs' do describe 'with no options' do before { run_generator %w(posts) } describe 'edit' do subject { file("spec/views/posts/edit.html.erb_spec.rb") } - it { should exist } - it { should contain(/require 'spec_helper'/) } - it { should contain(/describe "(.*)\/edit"/) } - it { should contain(/it "renders the edit (.*) form"/) } + it { is_expected.to exist } + it { is_expected.to contain(/require 'spec_helper'/) } + it { is_expected.to contain(/describe "(.*)\/edit"/) } + it { is_expected.to contain(/it "renders the edit (.*) form"/) } end describe 'index' do subject { file("spec/views/posts/index.html.erb_spec.rb") } - it { should exist } - it { should contain(/require 'spec_helper'/) } - it { should contain(/describe "(.*)\/index"/) } - it { should contain(/it "renders a list of (.*)"/) } + it { is_expected.to exist } + it { is_expected.to contain(/require 'spec_helper'/) } + it { is_expected.to contain(/describe "(.*)\/index"/) } + it { is_expected.to contain(/it "renders a list of (.*)"/) } end describe 'new' do subject { file("spec/views/posts/new.html.erb_spec.rb") } - it { should exist } - it { should contain(/require 'spec_helper'/) } - it { should contain(/describe "(.*)\/new"/) } - it { should contain(/it "renders new (.*) form"/) } + it { is_expected.to exist } + it { is_expected.to contain(/require 'spec_helper'/) } + it { is_expected.to contain(/describe "(.*)\/new"/) } + it { is_expected.to contain(/it "renders new (.*) form"/) } end describe 'show' do subject { file("spec/views/posts/show.html.erb_spec.rb") } - it { should exist } - it { should contain(/require 'spec_helper'/) } - it { should contain(/describe "(.*)\/show"/) } - it { should contain(/it "renders attributes in <p>"/) } + it { is_expected.to exist } + it { is_expected.to contain(/require 'spec_helper'/) } + it { is_expected.to contain(/describe "(.*)\/show"/) } + it { is_expected.to contain(/it "renders attributes in <p>"/) } end end describe 'with --no-template-engine' do before { run_generator %w(posts --no-template-engine) } describe 'edit' do subject { file("spec/views/posts/edit.html._spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end describe 'index' do subject { file("spec/views/posts/index.html._spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end describe 'new' do subject { file("spec/views/posts/new.html._spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end describe 'show' do subject { file("spec/views/posts/show.html._spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end end describe 'with --no-view-specs' do before { run_generator %w(posts --no-view-specs) } describe 'edit' do subject { file("spec/views/posts/edit.html.erb_spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end describe 'index' do subject { file("spec/views/posts/index.html.erb_spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end describe 'new' do subject { file("spec/views/posts/new.html.erb_spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end describe 'show' do subject { file("spec/views/posts/show.html.erb_spec.rb") } - it { should_not exist } + it { is_expected.not_to exist } end end end describe 'routing spec' do subject { file('spec/routing/posts_routing_spec.rb') } describe 'with default options' do before { run_generator %w(posts) } - it { should contain(/require "spec_helper"/) } - it { should contain(/describe PostsController/) } - it { should contain(/describe "routing"/) } + it { is_expected.to contain(/require "spec_helper"/) } + it { is_expected.to contain(/describe PostsController/) } + it { is_expected.to contain(/describe "routing"/) } end describe 'with --no-routing-specs' do before { run_generator %w(posts --no-routing_specs) } - it { should_not exist } + it { is_expected.not_to exist } end end end