Sha256: 68f5332a0a37454f089341f90d1dd9be563276ebf98309a0f207bd234da34f9a

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

root_dir = RailsAssist::Directory.rails_root

describe 'controller' do
  use_orm :none
  use_helpers :controller, :app
  
  before :each do              
    create_empty_tmp :controller    
    create_controller :account do
      %q{
        def index
        end
      }
    end    
  end

  after :each do              
    remove_controllers :account, :person
  end

  it "should not have :controller artifact :person" do      
    root_dir.should_not have_artifact :person, :controller
  end

  it "should have model" do
    create_model :user
    root_dir.should have_artifact :user, :model 
    puts read_model :user
    root_dir.should have_model :user
  end
    
  it "should have an account_controller file that contains an AccountController class with an index method inside" do      
    root_dir.should have_artifact :account, :controller do |content|
      content.should have_method :index
    end
  
    create_controller :person do
      %q{
        def index
        end
      }
    end    
  
    root_dir.should have_artifacts :controller, :account, :person
    root_dir.should have_artifacts :controller, [:account, :person]
  end
  
  it "should not have :controller artifacts :account and :user" do       
    root_dir.should_not have_artifacts :controller, [:account, :user]    
  end 
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails-app-spec-0.5.0 spec/rails_app_spec/matchers/artifact/core/have_artifacts_spec.rb
rails-app-spec-0.4.0 spec/rails_app_spec/matchers/artifact/core/have_artifacts_spec.rb
rails-app-spec-0.3.3 spec/rails_app_spec/matchers/artifact/core/have_artifacts_spec.rb