This file contains hidden or 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
| before do | |
| @resources = FactoryGirl.create_list(:resource, 10) | |
| end | |
| it 'それぞれのResourceが表示されていること' do | |
| visit '/resources' | |
| @resources.each do |r| | |
| expect(page).to have_content(/#{r.id}\s+#{r.attr1}\s+#{r.attr2}\s+#{r.attr3}/) | |
| end | |
| end |
This file contains hidden or 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
| context '入力が正しくない' do | |
| [ | |
| [:name, "未入力", nil, "can't be blank"], | |
| [:name, "101文字以上", 'a' * 101, "is too long"], | |
| [:display, "101文字以上", 'a' * 101, "is too long"] | |
| ] | |
| .each do |attr, state, value, msg| | |
| context "#{attr.to_s.humanize}が#{state}" do | |
| let(:input) { valid_input.merge(attr => value) } |
This file contains hidden or 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
| class Lens < Struct.new(:name, :mm, :f, :close_up, :generation) | |
| def initialize(attrs) | |
| super(*self.class.members.inject([]) {|r, x| r << attrs[x] }) | |
| end | |
| end | |
| Lens.new( | |
| f: 2, | |
| generation: '3rd', |
This file contains hidden or 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' | |
| shared_examples "valid" do | |
| it { expect { subject }.not_to raise_error(Avalon::Error) } | |
| end | |
| shared_examples "invalid" do | |
| it { expect { subject }.to raise_error(Avalon::Error) } | |
| end |
NewerOlder