Class: Embryo::RubyTemplate::Action::Index

Inherits:
Embryo::RubyTemplate::Action show all
Defined in:
lib/rails-embryo/ruby_template/action/index.rb

Instance Method Summary collapse

Methods inherited from Embryo::RubyTemplate::Action

#initialize

Methods inherited from Embryo::RubyTemplate

#text

Constructor Details

This class inherits a constructor from Embryo::RubyTemplate::Action

Instance Method Details

#controller_method_codeObject



5
6
7
# File 'lib/rails-embryo/ruby_template/action/index.rb', line 5

def controller_method_code
  method_code :index, "@#{model.plural} = #{model.class_name}.all"
end

#controller_spec_codeObject



9
10
11
12
13
14
15
16
# File 'lib/rails-embryo/ruby_template/action/index.rb', line 9

def controller_spec_code
  spec_group_code "#index",
    spec_code("assigns the collection of #{model.plural}",
      "#{model.singular} = create :#{model.symbol}",
      "get :index",
      "expect(assigns :#{model.plural}).to eq [#{model.singular}]"),
    spec_code("succeeds", "get :index", "expect(response).to be_success")
end