Last active
August 29, 2015 14:19
-
-
Save brunoocasali/62ae5830304a47b54f8e 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
require 'rails_helper' | |
module MpaStory | |
module Debugger | |
RSpec.describe ChildrenHelper, type: :helper do | |
describe '.show_as_link?' do | |
context 'when the archetype is not a story' do | |
let(:archetype) { create(:mpa_story_archetype, tier: ArchetypeTier::PROCESS) } | |
it 'needs to return a link tag' do | |
expect(helper.show_as_link?(archetype)).to match(/href=/) | |
end | |
end | |
context 'when the archetype is a story' do | |
let(:archetype) { create(:mpa_story_archetype, tier: ArchetypeTier::STORY) } | |
it 'needs to return the name of archetype' do | |
expect(helper.show_as_link?(archetype)) | |
.to(match(/#{archetype.tier_humanize.first}#{archetype.id}/)) | |
end | |
end | |
end | |
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
FactoryGirl.define do | |
sequence :mpa_story_archetype_name do |n| | |
"MPAStory #{n}" | |
end | |
sequence :mpa_story_archetype_api_name do |n| | |
"mpa_story_#{n}" | |
end | |
factory :mpa_story_archetype, class: 'MpaStory::Archetype' do | |
name { generate :mpa_story_archetype_name } | |
description { "some text" } | |
kind { MpaStory::ArchetypeKind.list.sample } | |
tier { MpaStory::ArchetypeTier.list.sample } | |
interaction { MpaStory::ArchetypeInteraction.list.sample } | |
execution { MpaStory::ArchetypeExecution.list.sample } | |
api_name { generate :mpa_story_archetype_api_name } | |
klass nil | |
expected_runtime nil | |
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 'rails_helper' | |
module MpaStory | |
module Debugger | |
RSpec.describe ChildrenHelper, type: :helper do | |
describe '.show_as_link?' do | |
context 'when the archetype is not a story' do | |
let(:archetype) { create(:mpa_story_archetype, tier: ArchetypeTier::PROCESS) } | |
it 'needs to return a link tag' do | |
expect(helper.show_as_link?(archetype)).to match(/href=/) | |
end | |
end | |
context 'when the archetype is a story' do | |
let(:archetype) { create(:mpa_story_archetype, tier: ArchetypeTier::STORY) } | |
it 'needs to return the name of archetype' do | |
expect(helper.show_as_link?(archetype)) | |
.to(match(/#{archetype.tier_humanize.first}#{archetype.id}/)) | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment