README.md in storyblok-2.1.1 vs README.md in storyblok-3.0.0
- old
+ new
@@ -1,7 +1,13 @@
+[](https://codeclimate.com/github/storyblok/storyblok-ruby/test_coverage)
+
+[](https://rubygems.org/gems/storyblok)
+[](https://www.rubydoc.info/gems/storyblok)
+[](https://codeclimate.com/github/storyblok/storyblok-ruby/maintainability)
+
# About
-This is the Storyblok ruby client for easy access of the management and content delivery api.
+This is the official [Storyblok](https://www.storyblok.com/) ruby client for easy access of the management and content delivery api.
## Install
```bash
gem 'storyblok'
@@ -118,11 +124,11 @@
```ruby
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
# Get your spaces
-client.get('spaces')
+client.get('spaces/')
```
### Create a story
```ruby
@@ -156,16 +162,16 @@
Storyblok's richtext field also let's you insert content blocks. To render these blocks you can define a Lambda.
```ruby
# Option 1: Define the resolver when initializing
client = Storyblok::Client.new(
- component_resolver: ->(component, data) => {
+ component_resolver: ->(component, data) {
case component
when 'button'
"<button>#{data['text']}</button>"
when 'your_custom_component'
- "<div class="welcome">#{data['welcome_text']}</div>"
+ "<div class='welcome'>#{data['welcome_text']}</div>"
end
}
)
# Option 2: Define the resolver afterwards
@@ -181,9 +187,35 @@
~~~
gem build storyblok.gemspec
gem push storyblok-2.0.X.gem
~~~
+### Running Tests
+We use [RSpec](http://rspec.info/) for testing.
+
+#### To run the whole test suite you will need export the environment variables, ATTENTION when running the test suit with the variable `REDIS_URL` exported, the test suite will remove the keys with this pattern `storyblok:*` from the redis database defined by `REDIS_URL`
+
+```bash
+export REDIS_URL="redis://localhost:6379"
+```
+
+Optionally you can generate the test report coverage by setting the environment variable
+
+```bash
+export COVERAGE=true
+```
+
+To run the whole test suite use the following command:
+
+```bash
+rspec
+```
+
+To run tests without redis cache tests (for when you don't have redis, or to avoid the test suite to remove the keys with this pattern `storyblok:*` ):
+
+```bash
+rspec --tag ~redis_cache:true
+```
### License
This project is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)