下面是我需要做的。
要运行规格,您需要安装RSpec。首先,在项目的根目录中运行gem install bundler。然后,运行bundle install。要运行单个规格文件,请运行如下命令:bundle exec rspec spec / 00_hello_spec.rb。要一次运行所有规格,请运行bundle exec rspec。
因此,我在终端输入了gem install bundler,并得到了 您对/Library/Ruby/Gems/2.3.0目录没有写权限。
这是在项目文件中的原子* source“ https://rubygems.org ” gem“ rspec”,“〜> 3.2.0” *
我的问题是:
似乎终端机给了我响应,因为我不应该更改ruby上的任何内容,而需要将安装包捆绑在atom内吗?谁能告诉我如何使用原子或在原子中运行任何东西?
非常感谢!
我正在将我的 vuejs 应用程序迁移到打字稿以获得更好的可维护性。这是我的问题:
我创建了一个TokenService
从本地存储中检索管理员的令牌:
// token.service.js
/*
Get the admin's token from localstorage.
@return {object} The token
*/
getToken() {
return localStorage.getItem("token")
}
Run Code Online (Sandbox Code Playgroud)
为了让服务在所有组件中都可用,而不必在每个组件中都导入它,我将该服务添加到Vue.prototype
:
// main.js
Vue.prototype.$tokenService = TokenService
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试this.$tokenService
从我AdminWorkerPage
用打字稿编写的组件访问 时,出现错误:TS2339:属性 '$tokenService' 在类型 'AdminWorkerPage' 上不存在。
// AdminWorkerPage.ts
import { Vue, Component, Prop } from 'vue-property-decorator'
@Component({})
export default class AdminWorkerPage extends Vue {
broadcast(): Promise<void> {
token: this.$tokenService.getToken() // <-- $tokenService used here !
...
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我的文件是用 javascript 编写时,我没有问题。
如何告诉编译器该属性存在于组件中?
ECONNREFUSED 127.0.0.1:80
我在使用 Nestjs 运行测试 e2e 来测试 dto 时遇到错误。
这是我的代码:
const TEST_URL = 'test';
@Controller(TEST_URL)
class TestController {
@Post()
public test(@Body() param: TimeTableParam) {
// nothing
}
}
describe('TimeTableParam', () => {
let app: INestApplication;
beforeAll(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [TestController],
}).compile();
app = module.createNestApplication();
await app.init();
});
afterAll(async () => {
await app.close();
});
describe('...', () => {
it(`should ...`, () => {
//...
});
});
});
Run Code Online (Sandbox Code Playgroud) 我是 Gatsby 及其用于检索资产的 graphQL 查询系统的新手。我有一个Image
可以获取图像并显示它的工作组件。我想自定义图像的名称,但我不知道如何修改。
这是工作组件:
const Image = () => (
<StaticQuery
query={graphql`
query {
// fetching the image gatsby-astronaut.png
placeholderImage: file(relativePath: { eq: "gatsby-astronaut.png" }) {
childImageSharp {
fluid(maxWidth: 300) {
...GatsbyImageSharpFluid
}
}
}
}
`}
render={data => <Img fluid={data.placeholderImage.childImageSharp.fluid} />}
/>
);
Run Code Online (Sandbox Code Playgroud)
这是我试图拥有可自定义图像的内容:
const Image = ({ imgName }: { imgName: string }) => (
<StaticQuery
query={graphql`
query {
// fetching the image imgName
placeholderImage: file(relativePath: { eq: "${imgName}.png" }) {
childImageSharp {
fluid(maxWidth: …
Run Code Online (Sandbox Code Playgroud) typescript ×2
atom-editor ×1
bundler ×1
e2e-testing ×1
gatsby ×1
graphql ×1
install ×1
javascript ×1
macos ×1
nestjs ×1
rubygems ×1
vuejs2 ×1