Skip to content

Instantly share code, notes, and snippets.

View igkuz's full-sized avatar

Igor Kuznetsov igkuz

  • Tiny
  • Valencia, Spain
View GitHub Profile
def index
@people = People.all
respond_to do |format|
format.html
format.xml { render xml: @people.to_xml }
end
end
def fill_view(models, active_index)
if models.count > 0
@broadcast.truncate
@items = models
@current_item_index = active_index
@current_item = models[active_index]
if models[0].is_a?(Channel)
@channel_info_area_logo.props.url = @current_item.small_logo
@channel_info_area_text.props.text = @current_item.name
hide_episode_description
@igkuz
igkuz / gist:5670054
Last active December 17, 2015 20:48
git branch develop
git flow feature start 00001_my_super_feature
git co staging
git merge feature/00001_my_super_feature
bundle exec rake
git push
git flow feature finish 00001_my_super_feature
FactoryGirl.define do
factory :channel do
name
end
end
@igkuz
igkuz / 1.rb
Last active December 17, 2015 14:39
...
it "should show another channels" do
channels = FactoryGirl.build_list(:channels)
channels_view = app.view('channels')
channels_view.show_another_channels(channels)
end
...
gem 'factory_girl'
spec_helper.rb:
....
FactoryGirl.find_definitions
@igkuz
igkuz / 1.rb
Last active December 17, 2015 14:39
class Channels < Clutter::Group
dsl do |o|
# some markup here
end
def show_channels(channels)
# some actions with dom here
end
end
class Channel
include Virtus
atribute :id, Integer
attribute :name, String
end
@igkuz
igkuz / 1.rb
Last active December 17, 2015 14:39
describe "Channels Api Controller" do
it "should get all channels from api" do
stub_requested = stub_request(:get, channels_api_url).
with(body: { credentials: credentials }).
to_return(status: 200, body: load_fixture('channels.json'), headers: {})
channels_api_controller = app.controller('api/channels_controller')
channels_api_controller.all_channels.on_complete do |models|
class Api::ChannelsController < CS::Base::Controller
def all_channels
SFK::Http.get(channels_url, options).transform do |data|
parse_data(models)
end
end
def parse_data(data)
models = []