Created
September 22, 2015 04:53
-
-
Save sebastjan-hribar/9321083ee365e76406ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Failure: | |
Web::Controllers::Projects::Show#test_0001_exposes a project [C:/Users/sebastjan/Documents/projekti/lotus/myProject/spec/web/controllers/projects/show_spec.rb:19]: | |
Expected: {:project=>#<Project:0x5de5668 @name="Test povezave1", @number="123", | |
@customer="Customer 1", @creation_date="23. 02. 2015", @purchase_order="sl-123", | |
@deadline="01. 04. 2015", @id=435>} | |
Actual: {:params=>#<Web::Controllers::Projects::Show::Params:0x5de53f8 | |
@env={:id=>435, "lotus.action"=>#<Web::Controllers::Projects::Show:0x5de54d0 @_env={...}, | |
@headers={"X-Frame-Options"=>"DENY", "Content-Security-Policy"=>"default-src 'none'; script-src 'self'; | |
connect-src 'self'; img-src 'self'; style-src 'self';", "Content-Type"=>"text/html; charset=utf-8"}, | |
@params=#<Web::Controllers::Projects::Show::Params:0x5de53f8 ...>, | |
@project=#<Project:0x5deff28 @name="Test povezave1", @number="123", | |
@customer="Customer 1", @creation_date="23. 02. 2015", @purchase_order="sl-123", | |
@deadline="01. 04. 2015", @id=435>, @accept="*/*", @format=:html, | |
@exposures={...}>}, @raw=#<Lotus::Utils::Attributes:0x5de5368 | |
@attributes={"id"=>435}>, @attributes=#<Lotus::Utils::Attributes:0x5de5368 @attributes={"id"=>435}>, | |
@errors=#<Lotus::Validations::Errors:0x5defcb8 @errors={}>>, | |
:errors=>#<Lotus::Validations::Errors:0x5defcb8 @errors={}>, :format=>:html, | |
:project=>#<Project:0x5deff28 @name="Test povezave1", @number="123", | |
@customer="Customer 1", @creation_date="23. 02. 2015", @purchase_order="sl-123", @deadline="01. 04. 2015", @id=435>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Web::Controllers::Projects | |
class Show | |
include Web::Action | |
expose :project | |
def call(params) | |
@project = ProjectRepository.find(params[:id]) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require_relative '../../../../apps/web/controllers/projects/show' | |
describe Web::Controllers::Projects::Show do | |
before do | |
ProjectRepository.clear | |
@project = ProjectRepository.create(Project.new(name: 'Test povezave1', number: '123', customer: 'Customer 1', | |
creation_date: '23. 02. 2015', purchase_order: 'sl-123', | |
deadline: '01. 04. 2015')) | |
end | |
let(:action) {Web::Controllers::Projects::Show.new} | |
it "exposes a project" do | |
response = action.call(id: @project.id) | |
response[0].must_equal 200 | |
action.project.must_equal @project | |
action.exposures.must_equal({project: @project}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment