Class: Embryo::RubyTemplate::Action::Index
Instance Method Summary
collapse
#initialize
#text
Instance Method Details
#controller_method_code ⇒ Object
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_code ⇒ Object
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
|