1
私は他のプロジェクトでhave_db_columnを使用しましたが、私はundefined method
エラーを理解していません。
私はまた、あなたのspec_helper.rbでshouldaマッチャが含まれていなかったように見えますhas_column
未定義のメソッド `has_db_column? ' #<通知:0xcc2b350>
describe Notification do
context "has valid db fields" do
subject { Factory.build(:notification)}
it { should be_valid }
it { should have_db_column(:title)}
end
end
mysql> describe notifications;
+---------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| title | varchar(255) | YES | | NULL | |
Factory.define :notification do |notification|
notification.title {'test'}
end
マッチャーが含まれていないようですね... – lucapette
いいですよ、それでした!必要な 'gem shoulda'回答として投稿してください –
助けてくれてうれしい!私はそれをやった:) – lucapette