1
有谁知道正确的测试术语吗?我的控制器将数据保存到电子表格谷歌,所以Rspec的会是这样的如何为GoogleDrive API编写RSpec测试
it "sends the request into Google spreadsheet" do
expect{
post :create, request: FactoryGirl.attributes_for(:request)
}.to change(GoogleDrive::#some code that looks in the spreadsheet, :rows).by(1)
下面是控制器调用方法,仅供参考
def save_spreadsheet
connection = GoogleDrive.login(ENV['g_username'], ENV['g_password'])
ss = connection.spreadsheet_by_title('Test')
ws = ss.worksheets[0]
row = 1 + ws.num_rows #finds last row
ws[row, 1] = self.name
...
ws.save
end