Skip to content

Instantly share code, notes, and snippets.

@benlovell
Created July 7, 2015 19:44
Show Gist options
  • Save benlovell/a74cd9974971b3d57386 to your computer and use it in GitHub Desktop.
Save benlovell/a74cd9974971b3d57386 to your computer and use it in GitHub Desktop.
Lotus specs
describe Web::Controllers::Books::Index do
let(:action) { described_class.new }
let(:params) { Hash[] }
it 'is successful' do
response = action.call(params)
expect(response[0]).to eq 200
end
end
hurrdurr~/code/bookshelf % bundle exec rspec spec/web/controllers/books/index_spec.rb
.
Finished in 0.00112 seconds (files took 0.55421 seconds to load)
1 example, 0 failures
hurrdurr~/code/bookshelf % bundle exec rspec spec/web/views/books/index_spec.rb
.
Finished in 0.0015 seconds (files took 0.55361 seconds to load)
1 example, 0 failures
describe Web::Views::Books::Index do
let(:exposures) { Hash[foo: 'bar'] }
let(:template) { Lotus::View::Template.new('apps/web/templates/books/index.html.erb') }
let(:view) { described_class.new(template, exposures) }
let(:rendered) { view.render }
it 'exposes #foo' do
expect(view.foo).to eq exposures.fetch(:foo)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment